Skip to content
Browse files

Added a check to make sure that `get_db_prep_lookup` is not broken on…

… older

versions of Django.
  • Loading branch information...
1 parent 2342205 commit 67ec39a0e39118182ac92bcde91ac279981976e8 @gintas gintas committed Nov 7, 2010
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/picklefield/fields.py
View
10 src/picklefield/fields.py
@@ -141,8 +141,14 @@ def get_db_prep_lookup(self, lookup_type, value, connection=None, prepared=False
raise TypeError('Lookup type %s is not supported.' % lookup_type)
# The Field model already calls get_db_prep_value before doing the
# actual lookup, so all we need to do is limit the lookup types.
- return super(PickledObjectField, self).get_db_prep_lookup(
- lookup_type, value, connection=connection, prepared=prepared)
+ try:
+ return super(PickledObjectField, self).get_db_prep_lookup(
+ lookup_type, value, connection=connection, prepared=prepared)
+ except TypeError:
+ # Try not to break on older versions of Django, where the
+ # `connection` and `prepared` parameters are not available.
+ return super(PickledObjectField, self).get_db_prep_lookup(
+ lookup_type, value)
# South support; see http://south.aeracode.org/docs/tutorial/part4.html#simple-inheritance

0 comments on commit 67ec39a

Please sign in to comment.
Something went wrong with that request. Please try again.