list/enum, support find resolution

This commit is contained in:
j 2011-11-10 21:22:58 +00:00
commit 72c0917d2c
3 changed files with 22 additions and 7 deletions

View file

@ -59,6 +59,12 @@ def parseCondition(condition, user):
elif k == 'filename' and (user.is_anonymous() or \
not user.get_profile().capability('canSeeFiles')):
return Q(id=0)
elif k == 'resolution':
q = parseCondition({'key': 'width', 'value': v[0], 'operator': op}, user) \
& parseCondition({'key': 'height', 'value': v[1], 'operator': op}, user)
if exclude:
q = ~q
return q
elif isinstance(v, list) and len(v) == 2:
q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \
& parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user)