hooks/metadata.py
changeset 7543 570522300e22
parent 7514 32081892850e
child 7683 a21e24831ae4
--- a/hooks/metadata.py	Mon Jun 20 14:52:19 2011 +0200
+++ b/hooks/metadata.py	Tue Jun 21 10:57:25 2011 +0200
@@ -154,7 +154,7 @@
         entity = self.entity
         extid = entity.cw_metainformation()['extid']
         repo._type_source_cache[entity.eid] = (
-            entity.__regid__, self.newsource.uri, None)
+            entity.__regid__, self.newsource.uri, None, self.newsource.uri)
         if self.oldsource.copy_based_source:
             uri = 'system'
         else:
@@ -177,6 +177,7 @@
         schange = self._cw.transaction_data.setdefault('cw_source_change', {})
         schange[self.eidfrom] = self.eidto
 
+
 class ChangeEntitySourceAddHook(MetaDataHook):
     __regid__ = 'cw.metadata.source-change'
     __select__ = MetaDataHook.__select__ & hook.match_rtype('cw_source')
@@ -204,10 +205,12 @@
             # source='system'. External source will then have consider case
             # where `extid2eid` return a negative eid as 'this entity was known
             # but has been moved, ignore it'.
-            self._cw.system_sql('UPDATE entities SET eid=-eid,source=%(source)s WHERE eid=%(eid)s',
+            self._cw.system_sql('UPDATE entities SET eid=-eid,source=%(source)s '
+                                'WHERE eid=%(eid)s',
                                 {'eid': self.eidfrom, 'source': newsource.name})
             attrs = {'type': entity.__regid__, 'eid': entity.eid, 'extid': None,
-                     'source': 'system', 'mtime': datetime.now()}
+                     'source': 'system', 'asource': 'system',
+                     'mtime': datetime.now()}
             self._cw.system_sql(syssource.sqlgen.insert('entities', attrs), attrs)
             # register an operation to update repository/sources caches
             ChangeEntityUpdateCaches(self._cw, entity=entity,