hooks/metadata.py
changeset 9402 2c48c091b6a2
parent 9296 8a4175557426
child 9448 3e7cad3967c5
equal deleted inserted replaced
9127:aff75b69db92 9402:2c48c091b6a2
   147 
   147 
   148 
   148 
   149 
   149 
   150 # entity source handling #######################################################
   150 # entity source handling #######################################################
   151 
   151 
   152 class ChangeEntityUpdateCaches(hook.Operation):
   152 class ChangeEntitySourceUpdateCaches(hook.Operation):
   153     oldsource = newsource = entity = None # make pylint happy
   153     oldsource = newsource = entity = None # make pylint happy
   154 
   154 
   155     def postcommit_event(self):
   155     def postcommit_event(self):
   156         self.oldsource.reset_caches()
   156         self.oldsource.reset_caches()
   157         repo = self.session.repo
   157         repo = self.session.repo
   219             attrs = {'type': entity.cw_etype, 'eid': entity.eid, 'extid': None,
   219             attrs = {'type': entity.cw_etype, 'eid': entity.eid, 'extid': None,
   220                      'source': 'system', 'asource': 'system',
   220                      'source': 'system', 'asource': 'system',
   221                      'mtime': datetime.now()}
   221                      'mtime': datetime.now()}
   222             self._cw.system_sql(syssource.sqlgen.insert('entities', attrs), attrs)
   222             self._cw.system_sql(syssource.sqlgen.insert('entities', attrs), attrs)
   223             # register an operation to update repository/sources caches
   223             # register an operation to update repository/sources caches
   224             ChangeEntityUpdateCaches(self._cw, entity=entity,
   224             ChangeEntitySourceUpdateCaches(self._cw, entity=entity,
   225                                      oldsource=oldsource.repo_source,
   225                                            oldsource=oldsource.repo_source,
   226                                      newsource=syssource)
   226                                            newsource=syssource)