Skip to content

Commit

Permalink
Make sure datastore.query filter is a list
Browse files Browse the repository at this point in the history
  • Loading branch information
william-gr committed Jul 26, 2016
1 parent 86c28db commit 521f649
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/middlewared/middlewared/plugins/datastore.py
Expand Up @@ -30,10 +30,12 @@ def _filters_to_queryset(self, filters):

rv = []
for f in filters:
if not isinstance(f, (list, tuple)):
raise ValueError('Filter must be a list: {0}'.format(f))
if len(f) == 3:
name, op, value = f
if op not in opmap:
raise Exception("Invalid operation {0}".format(op))
raise Exception("Invalid operation: {0}".format(op))
q = Q(**{'{0}__{1}'.format(name, opmap[op]): value})
if op == '!=':
q.negate()
Expand Down

0 comments on commit 521f649

Please sign in to comment.