X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ldapdb%2Fmodels%2Fquery.py;h=def325f90ce29281f11d929f9914611bcce9b934;hb=cbd1e8c9fa9603b345a6a3ba07b8073c5fbfe727;hp=902d23713566abaed295050faa9b8aa22ac238f2;hpb=d83dc5004cd660c3aa43a56550c5e527524b5bde;p=matthijs%2Fupstream%2Fdjango-ldapdb.git diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index 902d237..def325f 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -18,8 +18,6 @@ # along with this program. If not, see . # -# -*- coding: utf-8 -*- - from copy import deepcopy import ldap @@ -43,10 +41,15 @@ class WhereNode(BaseWhereNode): else: # django 1.0 table, column, type, x, y, values = item + equal_bits = [ "(%s=%s)" % (column, value) for value in values ] + if len(equal_bits) == 1: + clause = equal_bits[0] + else: + clause = '(|%s)' % ''.join(equal_bits) if self.negated: - bits.append('(!(%s=%s))' % (column,values[0])) + bits.append('(!%s)' % clause) else: - bits.append('(%s=%s)' % (column,values[0])) + bits.append(clause) if len(bits) == 1: return bits[0] elif self.connector == AND: