hooks/syncschema.py
changeset 2882 d7f0646c65f7
parent 2847 c2ee28f4d4b1
child 2883 57ff19806026
equal deleted inserted replaced
2881:d1a5b77e42bc 2882:d7f0646c65f7
   140     operations. It will trigger internal structures rebuilding to consider
   140     operations. It will trigger internal structures rebuilding to consider
   141     schema changes
   141     schema changes
   142     """
   142     """
   143 
   143 
   144     def __init__(self, session):
   144     def __init__(self, session):
   145         self.repo = session.repo
       
   146         hook.SingleLastOperation.__init__(self, session)
   145         hook.SingleLastOperation.__init__(self, session)
   147 
   146 
   148     def commit_event(self):
   147     def commit_event(self):
   149         self.repo.set_schema(self.repo.schema)
   148         self.repo.set_schema(self.repo.schema)
   150 
   149 
   151 
   150 
   152 class MemSchemaOperation(hook.Operation):
   151 class MemSchemaOperation(hook.Operation):
   153     """base class for schema operations"""
   152     """base class for schema operations"""
   154     def __init__(self, session, kobj=None, **kwargs):
   153     def __init__(self, session, kobj=None, **kwargs):
   155         self.schema = session.schema
       
   156         self.kobj = kobj
   154         self.kobj = kobj
   157         # once Operation.__init__ has been called, event may be triggered, so
   155         # once Operation.__init__ has been called, event may be triggered, so
   158         # do this last !
   156         # do this last !
   159         hook.Operation.__init__(self, session, **kwargs)
   157         hook.Operation.__init__(self, session, **kwargs)
   160         # every schema operation is triggering a schema update
   158         # every schema operation is triggering a schema update