This is an automated email from the ASF dual-hosted git repository.
avia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ariatosca.git
The following commit(s) were added to refs/heads/master by this push:
new 1f5260c ARIA-417 Encoding models to json is too strict
1f5260c is described below
commit 1f5260cfb7516822d593d6103b7aa09ae9f86b84
Author: max-orlov <[email protected]>
AuthorDate: Tue Nov 28 17:24:31 2017 +0200
ARIA-417 Encoding models to json is too strict
---
aria/modeling/utils.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py
index 1b6b375..27d261d 100644
--- a/aria/modeling/utils.py
+++ b/aria/modeling/utils.py
@@ -35,15 +35,14 @@ class ModelJSONEncoder(JSONEncoder):
# 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)
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].