source: products/SimpleBlog/trunk/skins/SimpleBlog/simpleblog_validate_configlet.vpy @ 1

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

Building directory structure

  • Property svn:eol-style set to native
File size: 801 bytes
Line 
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
12if not maxItemsInPortlet:
13    state.setError('maxItemsInPortlet', 'Please enter a value')
14else:
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
22if state.getErrors():
23    return state.set(status='failure', portal_status_message='Please correct the indicated errors.')
24else:
25    return state.set(status='success', portal_status_message='ok')
Note: See TracBrowser for help on using the repository browser.