Commit bdb73d55 by Evan Heidtmann

Avoid swallowing exceptions thrown in callable attributes

parent 16ffe5e3
......@@ -71,7 +71,11 @@ def get_attribute(instance, attrs):
except ObjectDoesNotExist:
return None
if is_simple_callable(instance):
instance = instance()
try:
instance = instance()
except (AttributeError, KeyError) as exc:
raise ValueError('Exception raised in callable attribute "{0}"; original exception was: {1}'.format(attr, exc))
return instance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment