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
fix "exclude" operations
[matthijs/upstream/django-ldapdb.git]
/
ldapdb
/
models
/
query.py
diff --git
a/ldapdb/models/query.py
b/ldapdb/models/query.py
index ab5f19ec727b574cc845d44995d1b4371611ead7..1fddeeeb1aea3b8bb0ece0f4a7b079fa8d802b84 100644
(file)
--- a/
ldapdb/models/query.py
+++ b/
ldapdb/models/query.py
@@
-190,10
+190,11
@@
class WhereNode(BaseWhereNode):
else:
clause = '(|%s)' % ''.join(equal_bits)
else:
clause = '(|%s)' % ''.join(equal_bits)
- if self.negated:
- bits.append('(!%s)' % clause)
- else:
- bits.append(clause)
+ bits.append(clause)
+
+ if not len(bits):
+ return '', []
+
if len(bits) == 1:
sql_string = bits[0]
elif self.connector == AND:
if len(bits) == 1:
sql_string = bits[0]
elif self.connector == AND:
@@
-202,6
+203,10
@@
class WhereNode(BaseWhereNode):
sql_string = '(|%s)' % ''.join(bits)
else:
raise Exception("Unhandled WHERE connector: %s" % self.connector)
sql_string = '(|%s)' % ''.join(bits)
else:
raise Exception("Unhandled WHERE connector: %s" % self.connector)
+
+ if self.negated:
+ sql_string = ('(!%s)' % sql_string)
+
return sql_string, []
class Query(BaseQuery):
return sql_string, []
class Query(BaseQuery):