source: products/qPloneComments/branches/plone-2.5/skins/qplonecomments/validate_setup.vpy @ 494

Last change on this file since 494 was 1, checked in by myroslav, 18 years ago

Building directory structure

File size: 846 bytes
Line 
1## Controller Script Python "validate_setup"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind state=state 
7##bind subpath=traverse_subpath
8##parameters=
9##title=validates qpc setup
10##
11from Products.CMFCore.utils import getToolByName
12
13form = context.REQUEST.form
14email_key = 'email_discussion_manager'
15
16if email_key in form:
17    email = form[email_key]
18    pu = getToolByName(context, 'plone_utils')
19    if not pu.validateEmailAddresses(email):
20        from Products.qPloneComments.utils import getTranslFunction
21        transl_func = getTranslFunction(context)
22        state.setError(email_key, transl_func('Please submit a valid e-mail address.'))
23
24if state.getErrors():
25    return state.set(status='failure', portal_status_message='Please correct the indicated errors.')
26else:
27    return state
28
Note: See TracBrowser for help on using the repository browser.