cosmetics

This commit is contained in:
Ask Solem 2014-05-29 12:36:35 +01:00
parent 86274e967d
commit 3d63c6762d
1 changed files with 5 additions and 8 deletions

View File

@ -17,14 +17,11 @@ class JSONEncoder(json.JSONEncoder):
def default(self, obj, _super=json.JSONEncoder.default):
try:
_super(self, obj)
except TypeError:
try:
reducer = obj.__json__
except AttributeError:
raise
else:
return reducer()
reducer = obj.__json__
except AttributeError:
return _super(self, obj)
else:
return reducer()
def dumps(s, _dumps=json.dumps, cls=JSONEncoder):