This is an automated email from the ASF dual-hosted git repository.

mxmrlv pushed a commit to branch ARIA-417-Encoding-models-to-json-is-too-strict
in repository https://gitbox.apache.org/repos/asf/incubator-ariatosca.git

commit 01fe7e6cd720730b6940fc91170e20c5e1ebd1fa
Author: max-orlov <[email protected]>
AuthorDate: Tue Nov 28 17:24:31 2017 +0200

    a more generic support to json encoding
---
 aria/modeling/utils.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py
index 6e851f2..72fd51f 100644
--- a/aria/modeling/utils.py
+++ b/aria/modeling/utils.py
@@ -36,14 +36,13 @@ class ModelJSONEncoder(JSONEncoder):
         super(ModelJSONEncoder, self).__init__(*args, **kwargs)
 
     def default(self, o):  # pylint: disable=method-hidden
-        from .mixins import ModelMixin
-        if isinstance(o, ModelMixin):
+        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:
             return JSONEncoder.default(self, o)
 
 

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to