Skip to content

Commit

Permalink
Tighten type check in domain
Browse files Browse the repository at this point in the history
Fixes #15
Check that `domain[2]` is `str` because in some cases it's an `int` and `list`
operations don't work on `int`s.
  • Loading branch information
bwrsandman authored and Sandy Carter committed Aug 12, 2014
1 parent 4765f54 commit 7fc2ef4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mass_editing/models/ir_model_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ def search(
count=False):
model_domain = []
for domain in args:
if domain[0] == 'model_id' and domain[2]\
and type(domain[2]) != list:
model_domain += [(
'model_id', 'in', map(int, domain[2][1:-1].split(',')))]
if (len(domain) > 2 and domain[0] == 'model_id'
and isinstance(domain[2], basestring)):
model_domain += [
('model_id', 'in', map(int, domain[2][1:-1].split(',')))
]
else:
model_domain.append(domain)
return super(IrModelFields, self).search(
cr, uid, model_domain, offset=offset, limit=limit, order=order,
context=context, count=count)
context=context, count=count
)

0 comments on commit 7fc2ef4

Please sign in to comment.