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
convert get_db_prep_lookup() to new style (django 1.2+)
[matthijs/upstream/django-ldapdb.git]
/
ldapdb
/
models
/
query.py
diff --git
a/ldapdb/models/query.py
b/ldapdb/models/query.py
index 1fddeeeb1aea3b8bb0ece0f4a7b079fa8d802b84..91a3f62e2058bf8587342559c04ffefee3c58487 100644
(file)
--- a/
ldapdb/models/query.py
+++ b/
ldapdb/models/query.py
@@
-56,8
+56,13
@@
class Constraint(BaseConstraint):
"""
An object that can be passed to WhereNode.add() and knows how to
pre-process itself prior to including in the WhereNode.
"""
An object that can be passed to WhereNode.add() and knows how to
pre-process itself prior to including in the WhereNode.
+
+ NOTES:
+ - we redefine this class, because when self.field is None calls
+ Field().get_db_prep_lookup(), which short-circuits our LDAP-specific code.
+ - the connection argument defaults to None for django 1.1 compatibility
"""
"""
- def process(self, lookup_type, value):
+ def process(self, lookup_type, value
, connection=None
):
"""
Returns a tuple of data suitable for inclusion in a WhereNode
instance.
"""
Returns a tuple of data suitable for inclusion in a WhereNode
instance.
@@
-67,10
+72,12
@@
class Constraint(BaseConstraint):
try:
if self.field:
try:
if self.field:
- params = self.field.get_db_prep_lookup(lookup_type, value)
+ params = self.field.get_db_prep_lookup(lookup_type, value,
+ connection=connection, prepared=True)
db_type = self.field.db_type()
else:
db_type = self.field.db_type()
else:
- params = CharField().get_db_prep_lookup(lookup_type, value)
+ params = CharField().get_db_prep_lookup(lookup_type, value,
+ connection=connection, prepared=True)
db_type = None
except ObjectDoesNotExist:
raise EmptyShortCircuit
db_type = None
except ObjectDoesNotExist:
raise EmptyShortCircuit