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 b30d1c5bc99d7edeb97b670f8dc4340f733406a3 Author: max-orlov <ma...@gigaspaces.com> 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 "comm...@ariatosca.apache.org" <comm...@ariatosca.apache.org>.