Skip to content
This repository has been archived by the owner on Jul 17, 2018. It is now read-only.

Commit

Permalink
ARIA-417 Encoding models to json is too strict
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmrlv authored and aviaefrat committed Dec 4, 2017
1 parent bc2701c commit 1f5260c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aria/modeling/utils.py
Expand Up @@ -35,15 +35,14 @@ def __init__(self, *args, **kwargs):
# Just here to make sure Sphinx doesn't grab the base constructor's docstring
super(ModelJSONEncoder, self).__init__(*args, **kwargs)

def default(self, o): # pylint: disable=method-hidden
from .mixins import ModelMixin
if isinstance(o, ModelMixin):
def default(self, o): # pylint: disable=method-hidden
try:
if hasattr(o, 'value'):
dict_to_return = o.to_dict(fields=('value',))
return dict_to_return['value']
else:
return o.to_dict()
else:
except AttributeError:
return JSONEncoder.default(self, o)


Expand Down

0 comments on commit 1f5260c

Please sign in to comment.