Changed the handling of as_sql() versus _as_sql() in Query/QuerySet from 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
This commit is contained in:
Malcolm Tredinnick 2009-03-04 04:56:20 +00:00
parent f5063914b3
commit c7a1a9f380
2 changed files with 4 additions and 4 deletions

View File

@ -198,9 +198,9 @@ class Field(object):
# 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 File

@ -145,9 +145,9 @@ class RelatedField(object):
# 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)