source: products/qPloneComments/branches/plone3_extend/skins/qplonecomments/validate_setup.vpy @ 858

Last change on this file since 858 was 806, checked in by crchemist, 17 years ago

Add role 'Editor' to portal.

  • Property svn:eol-style set to native
File size: 873 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
12from Products.CMFPlone import MessageFactory
13from Products.CMFPlone import PloneMessageFactory
14_ = MessageFactory('plonecomments')
15
16form = context.REQUEST.form
17email_key = 'email_discussion_manager'
18
19if email_key in form:
20    email = form[email_key]
21    pu = getToolByName(context, 'plone_utils')
22    if not pu.validateEmailAddresses(email):
23        state.setError(email_key, _(u'Please submit a valid e-mail address.'))
24
25if state.getErrors():
26    return state.set(status='failure', portal_status_message=PloneMessageFactory(u'Please correct the indicated errors.'))
27else:
28    return state
29
Note: See TracBrowser for help on using the repository browser.