Exemplo n.º 1
0
 def __setitem__(self, key, value):
     obj = AbstractPriorModel.from_object(value)
     try:
         obj.id = getattr(self, str(key)).id
     except AttributeError:
         pass
     setattr(self, str(key), obj)
Exemplo n.º 2
0
 def __setattr__(self, key, value):
     if key.startswith("_"):
         super().__setattr__(key, value)
     else:
         try:
             super().__setattr__(key, AbstractPriorModel.from_object(value))
         except AttributeError:
             pass
Exemplo n.º 3
0
 def add_dict_items(self, item_dict):
     for key, value in item_dict.items():
         setattr(self, key, AbstractPriorModel.from_object(value))
Exemplo n.º 4
0
 def append(self, item):
     setattr(self, str(self.item_number),
             AbstractPriorModel.from_object(item))
     self.item_number += 1