Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed the handling of as_sql() versus _as_sql() in Query/QuerySet f…

…rom r9928.

This avoids inadvertently hiding AttributeError that is raised for other
reasons.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c7a1a9f3807c07b42952293e8bd03275a6651442 1 parent f506391
@malcolmt malcolmt authored
View
4 django/db/models/fields/__init__.py
@@ -198,9 +198,9 @@ def get_db_prep_lookup(self, lookup_type, value):
# be invoked before the final SQL is evaluated
if hasattr(value, 'relabel_aliases'):
return value
- try:
+ if hasattr(value, 'as_sql'):
sql, params = value.as_sql()
- except AttributeError:
+ else:
sql, params = value._as_sql()
return QueryWrapper(('(%s)' % sql), params)
View
4 django/db/models/fields/related.py
@@ -145,9 +145,9 @@ def pk_trace(value):
# be invoked before the final SQL is evaluated
if hasattr(value, 'relabel_aliases'):
return value
- try:
+ if hasattr(value, 'as_sql'):
sql, params = value.as_sql()
- except AttributeError:
+ else:
sql, params = value._as_sql()
return QueryWrapper(('(%s)' % sql), params)
Please sign in to comment.
Something went wrong with that request. Please try again.