Mondego/spacetime

Instancing a PCC object is allowed but fails on null primary key

Opened this issue · 1 comments

I accidentally created a subset object (e.g. ActiveCar() instead of Car()) and I got an error message indicating the object had no '_ID' attribute when trying to add it to frame (frame.add(ActiveCar())).

Raises two issues: 1) This is not a good error message to have; 2) Should I be allowed to instance a pcc type? If I am, spacetime should at least reject attempts to add it to frame.

  File "/Users/arthurvaladares/Dropbox/workspace/spacetime/python/spacetime_local/frame.py", line 338, in add
    self.object_store.insert(obj)
  File "/Users/arthurvaladares/Dropbox/workspace/spacetime/python/spacetime_local/store.py", line 56, in insert
    self._changes["new"].setdefault(obj.Class(), RecursiveDictionary()).setdefault(obj.__primarykey__, RecursiveDictionary()).rec_update(objjson)
  File "/Users/arthurvaladares/Dropbox/workspace/spacetime/python/datamodel/benchmark/datamodel.py", line 19, in ID
    return self._ID
AttributeError: '_Subset' object has no attribute '_ID'

On another note, we should also disallow a simulation being a producer of pcc types like subsets and joins, that would make no sense ( right?)