Last change
on this file since 3218 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | ## Controlled Python Script "validate_mapkeys" |
---|
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= map_api_keys='' |
---|
9 | ##title= |
---|
10 | ## |
---|
11 | |
---|
12 | if not map_api_keys: |
---|
13 | state.setError('map_api_keys', 'This field is required, please provide some information.') |
---|
14 | |
---|
15 | if map_api_keys: |
---|
16 | for row in map_api_keys: |
---|
17 | i = map_api_keys.index(row) + 1 |
---|
18 | if row == '': |
---|
19 | state.setError('map_api_keys', 'Line %d is empty.' % i) |
---|
20 | break |
---|
21 | if row.find('|') == -1: |
---|
22 | state.setError('map_api_keys', 'In line %d skipped pipe (|) symbol.' % i) |
---|
23 | break |
---|
24 | elif row.find('|') == 0: |
---|
25 | state.setError('map_api_keys', 'In line %d skipped portal root before pipe (|) symbol.' % i) |
---|
26 | break |
---|
27 | elif row.find('|') == len(row)-1: |
---|
28 | state.setError('map_api_keys', 'In line %d skipped map api key after pipe (|) symbol.' % i) |
---|
29 | break |
---|
30 | |
---|
31 | if state.getErrors(): |
---|
32 | return state.set(status='failure', portal_status_message='Please correct the indicated errors.') |
---|
33 | else: |
---|
34 | return state |
---|
35 | |
---|
Note: See
TracBrowser
for help on using the repository browser.