hooks/syncsources.py
changeset 7650 278fe9c1f3ad
parent 7536 29961a416faa
child 7735 71adfd6bab38
equal deleted inserted replaced
7649:ede740bd7077 7650:278fe9c1f3ad
    51                                   fail_if_unknown=not self._cw.vreg.config.repairing)
    51                                   fail_if_unknown=not self._cw.vreg.config.repairing)
    52         SourceAddedOp(self._cw, entity=self.entity)
    52         SourceAddedOp(self._cw, entity=self.entity)
    53 
    53 
    54 
    54 
    55 class SourceRemovedOp(hook.Operation):
    55 class SourceRemovedOp(hook.Operation):
    56     def precommit_event(self):
    56     def postcommit_event(self):
    57         self.session.repo.remove_source(self.uri)
    57         self.session.repo.remove_source(self.uri)
    58 
    58 
    59 class SourceRemovedHook(SourceHook):
    59 class SourceRemovedHook(SourceHook):
    60     __regid__ = 'cw.sources.removed'
    60     __regid__ = 'cw.sources.removed'
    61     __select__ = SourceHook.__select__ & is_instance('CWSource')
    61     __select__ = SourceHook.__select__ & is_instance('CWSource')
    69 class SourceUpdatedOp(hook.DataOperationMixIn, hook.Operation):
    69 class SourceUpdatedOp(hook.DataOperationMixIn, hook.Operation):
    70 
    70 
    71     def precommit_event(self):
    71     def precommit_event(self):
    72         self.__processed = []
    72         self.__processed = []
    73         for source in self.get_data():
    73         for source in self.get_data():
    74             conf = source.repo_source.check_config(source)
    74             if not self.session.deleted_in_transaction(source.eid):
    75             self.__processed.append( (source, conf) )
    75                 conf = source.repo_source.check_config(source)
       
    76                 self.__processed.append( (source, conf) )
    76 
    77 
    77     def postcommit_event(self):
    78     def postcommit_event(self):
    78         for source, conf in self.__processed:
    79         for source, conf in self.__processed:
    79             source.repo_source.update_config(source, conf)
    80             source.repo_source.update_config(source, conf)
    80 
    81