Remove crazy JSON encoding things that are no longer used (#13029)
Catch JSON encoding errors in HTTP view
This commit is contained in:
1 parent
ae286a550b
commit
0a2e949e0a
4 files changed
+28
-15
No files matched your search
+1
-11
@@ -123,17 +123,7 @@ class JSONEncoder(json.JSONEncoder):
|
||||
elif hasattr(o, 'as_dict'):
|
||||
return o.as_dict()
|
||||
|
||||
try:
|
||||
return json.JSONEncoder.default(self, o)
|
||||
except TypeError:
|
||||
# If the JSON serializer couldn't serialize it
|
||||
# it might be a generator, convert it to a list
|
||||
try:
|
||||
return [self.default(child_obj)
|
||||
for child_obj in o]
|
||||
except TypeError:
|
||||
# Ok, we're lost, cause the original error
|
||||
return json.JSONEncoder.default(self, o)
|
||||
return json.JSONEncoder.default(self, o)
|
||||
|
||||
|
||||
def validate_api(api):
|
||||
|
||||
Reference in new issue
Block a user