ffnord / ffmap-backend

THIS PROJECT DOESN'T HAVE A MAINTAINER!
Other
20 stars 59 forks source link

More historical data #22

Closed jplitza closed 9 years ago

jplitza commented 10 years ago

I added DS to the NodeRRD for

To achieve this, I made the Node class handle arbitrary attributes and moved all the logic what to export to nodes.json to its export() method (instead of 3 different places throughout various files).

tcatm commented 9 years ago

I've tried merging this but I'm stuck at:

Traceback (most recent call last):
  File "./bat2nodes.py", line 72, in <module>
    db.dump_state("state.json")
  File "/home/ffmap/ffmap-backend2/nodedb.py", line 44, in dump_state
    json.dump(obj, f)
  File "/usr/lib/python3.2/json/__init__.py", line 178, in dump
    for chunk in iterable:
  File "/usr/lib/python3.2/json/encoder.py", line 407, in _iterencode
    for chunk in _iterencode_list(o, _current_indent_level):
  File "/usr/lib/python3.2/json/encoder.py", line 308, in _iterencode_list
    for chunk in chunks:
  File "/usr/lib/python3.2/json/encoder.py", line 384, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib/python3.2/json/encoder.py", line 418, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.2/json/encoder.py", line 169, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: NoneDict() is not JSON serializable
jplitza commented 9 years ago

I'm not sure as I didn't follow the latest changes, but probably replacing json.dump(obj, f) with json.dump(obj, f, cls=CustomJSONEncoder) in nodedb.py at line 38 and adding from json_encoder import CustomJSONEncoder would fix it.