Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
plone.app.form.kss.validation.FormlibValidation Class Reference
Inheritance diagram for plone.app.form.kss.validation.FormlibValidation:
Inheritance graph
[legend]
Collaboration diagram for plone.app.form.kss.validation.FormlibValidation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def validate_input
def macroContent
def issueAllPortalMessages

Static Public Attributes

tuple header_macros = ZopeTwoPageTemplateFile('browser/macro_wrapper.pt')

Detailed Description

KSS actions for formlib form inline validation

Definition at line 9 of file validation.py.


Member Function Documentation

Definition at line 45 of file plonekssview.py.

00045 
00046     def issueAllPortalMessages(self):
00047         if hasattr(self.request.RESPONSE, 'cookies'):
00048             cookie = self.request.RESPONSE.cookies.get(STATUSMESSAGEKEY)
00049             if cookie:
00050                 encodedstatusmessages = cookie['value']
00051                 statusmessages = _decodeCookieValue(encodedstatusmessages)
00052             else:
00053                 statusmessages = []
00054             for msg in statusmessages:
00055                 self.getCommandSet('plone').issuePortalMessage(msg)
00056             self.request.RESPONSE.expireCookie(STATUSMESSAGEKEY, path='/')

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.app.kss.plonekssview.PloneKSSView.macroContent (   self,
  macropath,
  kw 
) [inherited]

Definition at line 24 of file plonekssview.py.

00024 
00025     def macroContent(self, macropath, **kw):
00026         'Renders a macro and returns its text'
00027         path = macropath.split('/')
00028         if len(path) < 2 or path[-2] != 'macros':
00029             raise RuntimeError, 'Path must end with macros/name_of_macro (%s)' % (repr(macropath), )
00030         # needs string, do not tolerate unicode (causes but at traverse)
00031         jointpath = '/'.join(path[:-2]).encode('ascii')
00032         macroobj = self.context.restrictedTraverse(jointpath)
00033         try:
00034             the_macro = macroobj.macros[path[-1]]
00035         except AttributeError, IndexError:
00036             raise RuntimeError, 'Macro not found'
00037         #  
00038         # put parameters on the request, by saving the original context
00039         self.request.form, orig_form = kw, self.request.form
00040         content = self.header_macros.__of__(macroobj.aq_parent)(the_macro=the_macro)
00041         self.request.form = orig_form
00042         # Always encoded as utf-8
00043         content = force_unicode(content, 'utf')
00044         return content

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.app.form.kss.validation.FormlibValidation.validate_input (   self,
  formname,
  fieldname,
  value = None 
)
Given a form (view) name, a field name and the submitted
value, validate the given field.

Definition at line 14 of file validation.py.

00014 
00015     def validate_input(self, formname, fieldname, value=None):
00016         """Given a form (view) name, a field name and the submitted
00017         value, validate the given field.
00018         """
00019         
00020         # Abort if there was no value changed. Note that the actual value
00021         # comes along the submitted form, since a widget may require more than
00022         # a single form field to validate properly.
00023         if value is None:
00024             return
00025         
00026         context = aq_inner(self.context)
00027         request = aq_inner(self.request)
00028         
00029         # Find the form, the field and the widget
00030 
00031         form = getMultiAdapter((context, request), name=formname)
00032         form = form.__of__(context)
00033         
00034         raw_fieldname = fieldname[len(form.prefix)+1:]
00035         formlib_field = form.form_fields[raw_fieldname]
00036  
00037         widgets = formlib.setUpWidgets((formlib_field,), form.prefix, context, 
00038             request, form=form, adapters={}, ignore_request=False)
00039             
00040         widget = widgets[raw_fieldname]
00041         
00042         # Attempt to convert the value - this will trigge validation
00043         ksscore = self.getCommandSet('core')
00044         kssplone = self.getCommandSet('plone')
00045         validate_and_issue_message(ksscore, widget, fieldname, kssplone)
            

Here is the call graph for this function:


Member Data Documentation

tuple plone.app.kss.plonekssview.PloneKSSView.header_macros = ZopeTwoPageTemplateFile('browser/macro_wrapper.pt') [static, inherited]

Definition at line 22 of file plonekssview.py.


The documentation for this class was generated from the following file: