source: products/quintagroup.plonecomments/trunk/quintagroup/plonecomments/skins/quintagroup_plonecomments/validate_setup.vpy @ 1505

Last change on this file since 1505 was 822, checked in by koval, 17 years ago

little change in member properties extraction

File size: 885 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("quintagroup.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.