hooks/syncschema.py
changeset 4467 0e73d299730a
parent 4394 b98fbca17e9e
child 4570 ede247bbbf62
equal deleted inserted replaced
4466:8b0ca7904820 4467:0e73d299730a
   895         entity = self.entity
   895         entity = self.entity
   896         rtype = RelationType(name=entity.name,
   896         rtype = RelationType(name=entity.name,
   897                              description=entity.get('description'),
   897                              description=entity.get('description'),
   898                              meta=entity.get('meta', False),
   898                              meta=entity.get('meta', False),
   899                              inlined=entity.get('inlined', False),
   899                              inlined=entity.get('inlined', False),
   900                              symetric=entity.get('symetric', False),
   900                              symmetric=entity.get('symmetric', False),
   901                              eid=entity.eid)
   901                              eid=entity.eid)
   902         MemSchemaCWRTypeAdd(self._cw, rtype)
   902         MemSchemaCWRTypeAdd(self._cw, rtype)
   903 
   903 
   904 
   904 
   905 class BeforeUpdateCWRTypeHook(DelCWRTypeHook):
   905 class BeforeUpdateCWRTypeHook(DelCWRTypeHook):
   917 
   917 
   918     def __call__(self):
   918     def __call__(self):
   919         entity = self.entity
   919         entity = self.entity
   920         rschema = self._cw.vreg.schema.rschema(entity.name)
   920         rschema = self._cw.vreg.schema.rschema(entity.name)
   921         newvalues = {}
   921         newvalues = {}
   922         for prop in ('meta', 'symetric', 'inlined'):
   922         for prop in ('meta', 'symmetric', 'inlined'):
   923             if prop in entity:
   923             if prop in entity:
   924                 newvalues[prop] = entity[prop]
   924                 newvalues[prop] = entity[prop]
   925         if newvalues:
   925         if newvalues:
   926             MemSchemaCWRTypeUpdate(self._cw, rschema=rschema, values=newvalues)
   926             MemSchemaCWRTypeUpdate(self._cw, rschema=rschema, values=newvalues)
   927             SourceDbCWRTypeUpdate(self._cw, rschema=rschema, values=newvalues,
   927             SourceDbCWRTypeUpdate(self._cw, rschema=rschema, values=newvalues,