source: src/webapp/mapservice/src-gen/openapi_server/encoder.py@ 3a89adb

debian/bullseye
Last change on this file since 3a89adb was 3a89adb, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Moved mapservice to python flask with openapi generator

  • Property mode set to 100644
File size: 608 bytes
RevLine 
[3a89adb]1from connexion.apps.flask_app import FlaskJSONEncoder
2import six
3
4from openapi_server.models.base_model_ import Model
5
6
7class JSONEncoder(FlaskJSONEncoder):
8 include_nulls = False
9
10 def default(self, o):
11 if isinstance(o, Model):
12 dikt = {}
13 for attr, _ in six.iteritems(o.openapi_types):
14 value = getattr(o, attr)
15 if value is None and not self.include_nulls:
16 continue
17 attr = o.attribute_map[attr]
18 dikt[attr] = value
19 return dikt
20 return FlaskJSONEncoder.default(self, o)
Note: See TracBrowser for help on using the repository browser.