78 if hasattr(self.entity, '_cw_recreating'): |
78 if hasattr(self.entity, '_cw_recreating'): |
79 return |
79 return |
80 session = self._cw |
80 session = self._cw |
81 entity = self.entity |
81 entity = self.entity |
82 try: |
82 try: |
83 session.add_relation(entity.eid, 'is', |
83 #session.add_relation(entity.eid, 'is', |
84 eschema_type_eid(session, entity.__regid__)) |
84 # eschema_type_eid(session, entity.__regid__)) |
|
85 session.system_sql('INSERT INTO is_relation(eid_from,eid_to) VALUES (%s,%s)' |
|
86 % (entity.eid, eschema_type_eid(session, entity.id))) |
85 except IndexError: |
87 except IndexError: |
86 # during schema serialization, skip |
88 # during schema serialization, skip |
87 return |
89 return |
88 for etype in entity.e_schema.ancestors() + [entity.e_schema]: |
90 for etype in entity.e_schema.ancestors() + [entity.e_schema]: |
89 session.add_relation(entity.eid, 'is_instance_of', |
91 #session.add_relation(entity.eid, 'is_instance_of', |
90 eschema_type_eid(session, etype)) |
92 # eschema_type_eid(session, etype)) |
|
93 session.system_sql('INSERT INTO is_instance_of_relation(eid_from,eid_to) VALUES (%s,%s)' |
|
94 % (entity.eid, eschema_type_eid(session, etype))) |
91 |
95 |
92 |
96 |
93 class SetOwnershipHook(MetaDataHook): |
97 class SetOwnershipHook(MetaDataHook): |
94 """create a new entity -> set owner and creator metadata""" |
98 """create a new entity -> set owner and creator metadata""" |
95 __regid__ = 'setowner' |
99 __regid__ = 'setowner' |