projects
/
matthijs
/
upstream
/
django-ldapdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
support multiple values in WHERE clause
[matthijs/upstream/django-ldapdb.git]
/
ldapdb
/
models
/
query.py
diff --git
a/ldapdb/models/query.py
b/ldapdb/models/query.py
index 902d23713566abaed295050faa9b8aa22ac238f2..0aba5be23280063259e8b236f48d5b2d1345f577 100644
(file)
--- a/
ldapdb/models/query.py
+++ b/
ldapdb/models/query.py
@@
-18,8
+18,6
@@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# -*- coding: utf-8 -*-
-
from copy import deepcopy
import ldap
from copy import deepcopy
import ldap
@@
-43,10
+41,15
@@
class WhereNode(BaseWhereNode):
else:
# django 1.0
table, column, type, x, y, values = item
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 = '(|%s)' % ''.join(equal_bits)
+ else:
+ clause = equal_bits[0]
if self.negated:
if self.negated:
- bits.append('(!
(%s=%s))' % (column,values[0])
)
+ bits.append('(!
%s)' % clause
)
else:
else:
- bits.append(
'(%s=%s)' % (column,values[0])
)
+ bits.append(
clause
)
if len(bits) == 1:
return bits[0]
elif self.connector == AND:
if len(bits) == 1:
return bits[0]
elif self.connector == AND: