server/repository.py
changeset 4984 6cb91be7707f
parent 4958 665eacdd8c50
parent 4973 1e6536afa855
child 5030 5238d9a8dfee
equal deleted inserted replaced
4983:5594aadb740e 4984:6cb91be7707f
  1001         the entity instance
  1001         the entity instance
  1002         """
  1002         """
  1003         # init edited_attributes before calling before_add_entity hooks
  1003         # init edited_attributes before calling before_add_entity hooks
  1004         entity._is_saved = False # entity has an eid but is not yet saved
  1004         entity._is_saved = False # entity has an eid but is not yet saved
  1005         entity.edited_attributes = set(entity)
  1005         entity.edited_attributes = set(entity)
  1006         entity = entity.pre_add_hook()
  1006         entity_ = entity.pre_add_hook()
       
  1007         # XXX kill that transmutation feature !
       
  1008         if not entity_ is entity:
       
  1009             entity.__class__ = entity_.__class__
       
  1010             entity.__dict__.update(entity_.__dict__)
  1007         eschema = entity.e_schema
  1011         eschema = entity.e_schema
  1008         etype = str(eschema)
  1012         etype = str(eschema)
  1009         source = self.locate_etype_source(etype)
  1013         source = self.locate_etype_source(etype)
  1010         # attribute an eid to the entity before calling hooks
  1014         # attribute an eid to the entity before calling hooks
  1011         entity.set_eid(self.system_source.create_eid(session))
  1015         entity.set_eid(self.system_source.create_eid(session))