cubicweb/server/sources/datafeed.py
changeset 11253 be480b9d6ee2
parent 11252 6b1d09ef0c45
child 11254 4f467683b8c9
equal deleted inserted replaced
11252:6b1d09ef0c45 11253:be480b9d6ee2
   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),