make sure query criteria is a number for a 'number' field

This commit is contained in:
Helmut Merz 2012-07-09 16:30:36 +02:00
parent 67b969a481
commit b63b3b3b16
2 changed files with 5 additions and 2 deletions

View file

@ -162,6 +162,9 @@ class LeafQueryCriteria(BaseQueryCriteria, Element):
if comparisonValue in (None, '',):
return True
value = self.field.getSelectValue(row)
if (self.field.fieldType == 'number' and
isinstance(comparisonValue, basestring)):
comparisonValue = int(comparisonValue)
op = operators.get(self.operator)
if op is None:
op = getattr(standard_operators, self.operator, None)

View file

@ -72,8 +72,8 @@ class Field(Component):
return row.getRawValue(self.name)
def getSelectValue(self, row):
return getattr(row, self.name, None)
#return self.getRawValue(row) # better let row control selection...
return getattr(row, self.name, None) # backwards compatibility
# return self.getRawValue(row) # overwrite with this in subclass
def getValue(self, row):
value = self.getRawValue(row)