provide default field type; allow for value list when using 'in' operator
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3923 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
828e46a447
commit
e4a493ea2f
2 changed files with 16 additions and 3 deletions
|
@ -91,8 +91,13 @@ class Report(Template):
|
||||||
def components(self):
|
def components(self):
|
||||||
return self.fields
|
return self.fields
|
||||||
|
|
||||||
def getQueryFields(self):
|
def getQueryFields(self, include=None, exclude=None):
|
||||||
return [f for f in self.fields if 'query' in f.executionSteps]
|
result = [f for f in self.fields if 'query' in f.executionSteps]
|
||||||
|
if include:
|
||||||
|
result = [f for f in result if f.fieldType in include]
|
||||||
|
if exclude:
|
||||||
|
result = [f for f in result if f.fieldType not in exclude]
|
||||||
|
return result
|
||||||
|
|
||||||
def getOutputFields(self):
|
def getOutputFields(self):
|
||||||
return [f for f in self.fields if 'output' in f.executionSteps]
|
return [f for f in self.fields if 'output' in f.executionSteps]
|
||||||
|
@ -150,7 +155,14 @@ class LeafQueryCriteria(BaseQueryCriteria, Element):
|
||||||
return True
|
return True
|
||||||
value = self.field.getSelectValue(row)
|
value = self.field.getSelectValue(row)
|
||||||
if self.operator == 'in':
|
if self.operator == 'in':
|
||||||
return value in self.comparisonValue
|
if isinstance(value, (list, tuple)):
|
||||||
|
for v in value:
|
||||||
|
if v in self.comparisonValue:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return value in self.comparisonValue
|
||||||
op = getattr(operator, self.operator, None)
|
op = getattr(operator, self.operator, None)
|
||||||
if op is None:
|
if op is None:
|
||||||
# TODO: log warning
|
# TODO: log warning
|
||||||
|
|
|
@ -39,6 +39,7 @@ class Field(Component):
|
||||||
|
|
||||||
implements(IField)
|
implements(IField)
|
||||||
|
|
||||||
|
fieldType = 'text'
|
||||||
vocabulary = None
|
vocabulary = None
|
||||||
default = None
|
default = None
|
||||||
instance_name = None
|
instance_name = None
|
||||||
|
|
Loading…
Add table
Reference in a new issue