diff --git a/composer/report/base.py b/composer/report/base.py index e4cc6d7..8b33e5e 100644 --- a/composer/report/base.py +++ b/composer/report/base.py @@ -138,16 +138,21 @@ class LeafQueryCriteria(BaseQueryCriteria, Element): implements(ILeafQueryCriteria) - def __init__(self, name, operator, comparisonValue): + def __init__(self, name, operator, comparisonValue, field): self.name = name self.operator = operator self.comparisonValue = comparisonValue + self.field = field - def check(self, obj): - value = getattr(obj, self.name, None) - if value is not None: - return value in self.comparisonValue - return True + def check(self, row): + if not self.comparisonValue: + return True + #value = getattr(row, self.name, None) + value = self.field.getSelectValue(row) + #print '***', self.name, self.operator, self.comparisonValue, value + #if value is not None: + return value in self.comparisonValue + #return True class CompoundQueryCriteria(BaseQueryCriteria, Compound): diff --git a/composer/report/field.py b/composer/report/field.py index 32a1424..51da6f0 100644 --- a/composer/report/field.py +++ b/composer/report/field.py @@ -64,6 +64,10 @@ class Field(Component): def getRawValue(self, row): return getattr(row.context, self.name) + def getSelectValue(self, row): + return getattr(row, self.name, None) + #return self.getRawValue(row) + def getValue(self, row): value = self.getRawValue(row) if value is None: