cubicweb/hooks/syncschema.py
branch3.24
changeset 11807 9d478b81f6d7
parent 11774 51c160677afe
child 11903 6f36275a6e74
equal deleted inserted replaced
11806:5fdc92be3ba7 11807:9d478b81f6d7
   199 
   199 
   200     def precommit_event(self):
   200     def precommit_event(self):
   201         for eschema in self.cnx.repo.schema.entities():
   201         for eschema in self.cnx.repo.schema.entities():
   202             if not eschema.final:
   202             if not eschema.final:
   203                 clear_cache(eschema, 'ordered_relations')
   203                 clear_cache(eschema, 'ordered_relations')
       
   204                 # clear additional cached properties
       
   205                 try:
       
   206                     # is_composite use composite_rdef_roles, hence one try except should be enough
       
   207                     del eschema.composite_rdef_roles
       
   208                     del eschema.is_composite
       
   209                 except AttributeError:
       
   210                     pass
   204 
   211 
   205     def postcommit_event(self):
   212     def postcommit_event(self):
   206         repo = self.cnx.repo
   213         repo = self.cnx.repo
   207         # commit event should not raise error, while set_schema has chances to
   214         # commit event should not raise error, while set_schema has chances to
   208         # do so because it triggers full vreg reloading
   215         # do so because it triggers full vreg reloading