gumo-py / datastore-viewer

MIT License
7 stars 5 forks source link

TypeError: Object of type GeoPoint is not JSON serializable #64

Open krolaw opened 4 years ago

krolaw commented 4 years ago

GeoPoint is a legitimate Datastore field type, which appears to be unsupported, causing crashes:

ERROR:datastore_viewer:Exception on /datastore_viewer/api/projects/my-project-id/kinds/Student/entities [GET]
Traceback (most recent call last):
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/views.py", line 163, in dispatch_request
    return meth(*args, **kwargs)
  File "/home/krolaw/.local/lib/python3.8/site-packages/datastore_viewer/presentation/ui/api/__init__.py", line 78, in get
    return flask.jsonify({
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/json/__init__.py", line 370, in jsonify
    dumps(data, indent=indent, separators=separators) + "\n",
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/json/__init__.py", line 211, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 385, in dumps
    return cls(
  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 296, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 378, in iterencode
    return _iterencode(o, 0)
  File "/home/krolaw/.local/lib/python3.8/site-packages/flask/json/__init__.py", line 100, in default
    return _json.JSONEncoder.default(self, o)
  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 272, in default
    raise TypeError('Object of type %s is not JSON serializable' %
TypeError: Object of type GeoPoint is not JSON serializable
INFO:werkzeug:127.0.0.1 - - [17/Jun/2020 13:10:01] "GET /datastore_viewer/api/projects/my-project-id/kinds/Student/entities?perPage=25 HTTP/1.1" 500 -
EfrosIonelu commented 5 months ago

Same error