Last change
on this file was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
File size:
825 bytes
|
Rev | Line | |
---|
[1] | 1 | ## Script (Python) "simpleblog_validate_configlet" |
---|
| 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=maxItemsInPortlet |
---|
| 9 | ##title=Validates the SimpleBlog configlet |
---|
| 10 | ## |
---|
| 11 | |
---|
| 12 | if not maxItemsInPortlet: |
---|
| 13 | state.setError('maxItemsInPortlet', 'Please enter a value') |
---|
| 14 | else: |
---|
| 15 | try: |
---|
| 16 | i=int(maxItemsInPortlet) |
---|
| 17 | if i<1: |
---|
| 18 | state.setError('maxItemsInPortlet', 'Please enter an integer larger than 0') |
---|
| 19 | except ValueError: |
---|
| 20 | state.setError('maxItemsInPortlet', 'Please enter an integer') |
---|
| 21 | |
---|
| 22 | if state.getErrors(): |
---|
| 23 | return state.set(status='failure', portal_status_message='Please correct the indicated errors.') |
---|
| 24 | else: |
---|
| 25 | return state.set(status='success', portal_status_message='ok') |
---|
Note: See
TracBrowser
for help on using the repository browser.