Skip to content
Snippets Groups Projects
Commit 397c4223 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-272: try/except

parent ad3d64fb
No related branches found
No related tags found
1 merge request!213Resolve TMSS-272
......@@ -24,9 +24,12 @@ class JSONEditorField(serializers.JSONField):
serializer = self.parent
return fields.get_attribute(serializer.instance, self.schema_source.split('.'))
except (AttributeError, TypeError):
if json_data and '$schema' in json_data:
schema_url = json_data['$schema']
return json.loads(requests.get(schema_url).text)
try:
if json_data and '$schema' in json_data:
schema_url = json_data['$schema']
return json.loads(requests.get(schema_url).text)
except (KeyError, TypeError):
pass
return None
def to_internal_value(self, data):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment