inbetween queries

This commit is contained in:
j 2012-04-02 17:33:23 +02:00
parent 9da8c75f70
commit 00c8f47541
2 changed files with 4 additions and 5 deletions

View File

@ -72,7 +72,7 @@ def parseCondition(condition, user):
if exclude: if exclude:
q = ~q q = ~q
return q return q
elif isinstance(v, list) and len(v) == 2: elif isinstance(v, list) and len(v) == 2 and op == '=':
q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \ q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \
& parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user) & parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user)
if exclude: if exclude:

View File

@ -34,13 +34,12 @@ def parseCondition(condition, user):
exclude = True exclude = True
else: else:
exclude = False exclude = False
if op == '-': if isinstance(v, list) and len(v) == 2 and op == '=':
q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \ q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \
& parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user) & parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user)
if exclude: if exclude:
return ~q q = ~q
else: return q
return q
if k == 'id': if k == 'id':
v = decode_id(v) v = decode_id(v)
if isinstance(v, bool): #featured and public flag if isinstance(v, bool): #featured and public flag