|
Last change
on this file since 148 was
1,
checked in by myroslav, 21 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 | ## |
|---|
| 11 | from Products.CMFCore.utils import getToolByName |
|---|
| 12 | |
|---|
| 13 | form = context.REQUEST.form |
|---|
| 14 | email_key = 'email_discussion_manager' |
|---|
| 15 | |
|---|
| 16 | if 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 | |
|---|
| 24 | if state.getErrors(): |
|---|
| 25 | return state.set(status='failure', portal_status_message='Please correct the indicated errors.') |
|---|
| 26 | else: |
|---|
| 27 | return state |
|---|
| 28 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.