287 eidfrom=entity.eid, rtype=attr, eidto=value) |
287 eidfrom=entity.eid, rtype=attr, eidto=value) |
288 call_hooks('after_add_relation', cnx, |
288 call_hooks('after_add_relation', cnx, |
289 eidfrom=entity.eid, rtype=attr, eidto=value) |
289 eidfrom=entity.eid, rtype=attr, eidto=value) |
290 |
290 |
291 def source_uris(self, cnx): |
291 def source_uris(self, cnx): |
292 sql = ('SELECT extid, eid, type FROM entities, cw_source_relation ' |
292 sql = 'SELECT extid, eid, type FROM entities WHERE asource=%(source)s' |
293 'WHERE entities.eid=cw_source_relation.eid_from ' |
|
294 'AND cw_source_relation.eid_to=%s' % self.eid) |
|
295 return dict((self.decode_extid(uri), (eid, type)) |
293 return dict((self.decode_extid(uri), (eid, type)) |
296 for uri, eid, type in cnx.system_sql(sql).fetchall()) |
294 for uri, eid, type in cnx.system_sql(sql, {'source': self.uri}).fetchall()) |
297 |
295 |
298 def init_import_log(self, cnx, import_log_eid=None, **kwargs): |
296 def init_import_log(self, cnx, import_log_eid=None, **kwargs): |
299 if import_log_eid is None: |
297 if import_log_eid is None: |
300 import_log = cnx.create_entity('CWDataImport', cw_import_of=self, |
298 import_log = cnx.create_entity('CWDataImport', cw_import_of=self, |
301 start_timestamp=datetime.now(tz=utc), |
299 start_timestamp=datetime.now(tz=utc), |