# HG changeset patch # User Sylvain Thénault # Date 1298045260 -3600 # Node ID f4e798cf29b4becf4cc6576b342513fe41014e4c # Parent 50defc1974486837a66a7d9b5757937d921084f7 [source hooks] filter out case where source configuration doesn't have to be reloaded diff -r 50defc197448 -r f4e798cf29b4 hooks/syncsources.py --- a/hooks/syncsources.py Fri Feb 18 17:11:00 2011 +0100 +++ b/hooks/syncsources.py Fri Feb 18 17:07:40 2011 +0100 @@ -17,6 +17,8 @@ # with CubicWeb. If not, see . """hooks for repository sources synchronization""" +from socket import gethostname + from yams.schema import role_name from cubicweb import ValidationError @@ -87,11 +89,15 @@ __select__ = SourceHook.__select__ & is_instance('CWSourceHostConfig') events = ('after_add_entity', 'after_update_entity', 'before_delete_entity',) def __call__(self): - try: - SourceUpdatedOp.get_instance(self._cw).add_data(self.entity.cwsource) - except IndexError: - # XXX no source linked to the host config yet - pass + if self.entity.match_host(gethostname()): + if self.event == 'after_update_entity' and \ + not 'config' in self.entity.cw_edited: + return + try: + SourceUpdatedOp.get_instance(self._cw).add_data(self.entity.cwsource) + except IndexError: + # XXX no source linked to the host config yet + pass # source mapping synchronization. Expect cw_for_source/cw_schema are immutable