mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Let exceptions better bubble up through reverse_gfk
This commit is contained in:
@@ -101,12 +101,12 @@ def reverse_gfk(content_object):
|
|||||||
for example
|
for example
|
||||||
{ 'organization': '/api/v1/organizations/1/' }
|
{ 'organization': '/api/v1/organizations/1/' }
|
||||||
'''
|
'''
|
||||||
ret = {}
|
if content_object is None or not hasattr(content_object, 'get_absolute_url'):
|
||||||
try:
|
return {}
|
||||||
ret[camelcase_to_underscore(content_object.__class__.__name__)] = content_object.get_absolute_url()
|
|
||||||
except AttributeError:
|
return {
|
||||||
pass
|
camelcase_to_underscore(content_object.__class__.__name__): content_object.get_absolute_url()
|
||||||
return ret
|
}
|
||||||
|
|
||||||
|
|
||||||
class BaseSerializerMetaclass(serializers.SerializerMetaclass):
|
class BaseSerializerMetaclass(serializers.SerializerMetaclass):
|
||||||
|
|||||||
Reference in New Issue
Block a user