server/repository.py
branchstable
changeset 4973 1e6536afa855
parent 4946 2654cd5c87e0
child 4984 6cb91be7707f
equal deleted inserted replaced
4972:7b0cd6e024e2 4973:1e6536afa855
   973         the entity instance
   973         the entity instance
   974         """
   974         """
   975         # init edited_attributes before calling before_add_entity hooks
   975         # init edited_attributes before calling before_add_entity hooks
   976         entity._is_saved = False # entity has an eid but is not yet saved
   976         entity._is_saved = False # entity has an eid but is not yet saved
   977         entity.edited_attributes = set(entity)
   977         entity.edited_attributes = set(entity)
   978         entity = entity.pre_add_hook()
   978         entity_ = entity.pre_add_hook()
       
   979         # XXX kill that transmutation feature !
       
   980         if not entity_ is entity:
       
   981             entity.__class__ = entity_.__class__
       
   982             entity.__dict__.update(entity_.__dict__)
   979         eschema = entity.e_schema
   983         eschema = entity.e_schema
   980         etype = str(eschema)
   984         etype = str(eschema)
   981         source = self.locate_etype_source(etype)
   985         source = self.locate_etype_source(etype)
   982         # attribute an eid to the entity before calling hooks
   986         # attribute an eid to the entity before calling hooks
   983         entity.set_eid(self.system_source.create_eid(session))
   987         entity.set_eid(self.system_source.create_eid(session))