Last change
on this file since 1 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
File size:
864 bytes
|
Line | |
---|
1 | ## Script (Python) "validate_add_criterion" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= |
---|
8 | ## |
---|
9 | request = context.REQUEST |
---|
10 | indexId=request.get('field') |
---|
11 | criterion_type=request.get('criterion_type') |
---|
12 | supported = context.validateAddCriterion(indexId, criterion_type) |
---|
13 | |
---|
14 | atct_tool = context.portal_atct |
---|
15 | |
---|
16 | catalog = 'portal_catalog' |
---|
17 | if hasattr(context, 'getCatalog'): |
---|
18 | catalog = context.getCatalog() |
---|
19 | |
---|
20 | index_obj = atct_tool.getIndex(indexId, catalog) |
---|
21 | |
---|
22 | allowed_criteria = index_obj.criteria |
---|
23 | |
---|
24 | if not supported or criterion_type not in allowed_criteria: |
---|
25 | msg = 'Criterion of type ' +\ |
---|
26 | '"%s" not added, it does not work with index "%s".' % (criterion_type, indexId) |
---|
27 | return state.set(status='failure', portal_status_message=msg ) |
---|
28 | else: |
---|
29 | return state.set(status='success') |
---|
Note: See
TracBrowser
for help on using the repository browser.