server/sources/datafeed.py
branchstable
changeset 7698 1c7411535c2d
parent 7697 ef50074a0314
child 7699 d07cde311630
equal deleted inserted replaced
7697:ef50074a0314 7698:1c7411535c2d
   218         entity = super(DataFeedSource, self).before_entity_insertion(
   218         entity = super(DataFeedSource, self).before_entity_insertion(
   219             session, lid, etype, eid, sourceparams)
   219             session, lid, etype, eid, sourceparams)
   220         entity.cw_edited['cwuri'] = unicode(lid)
   220         entity.cw_edited['cwuri'] = unicode(lid)
   221         entity.cw_edited.set_defaults()
   221         entity.cw_edited.set_defaults()
   222         sourceparams['parser'].before_entity_copy(entity, sourceparams)
   222         sourceparams['parser'].before_entity_copy(entity, sourceparams)
   223         # avoid query to search full-text indexed attributes
       
   224         for attr in entity.e_schema.indexable_attributes():
       
   225             entity.cw_edited.setdefault(attr, u'')
       
   226         return entity
   223         return entity
   227 
   224 
   228     def after_entity_insertion(self, session, lid, entity, sourceparams):
   225     def after_entity_insertion(self, session, lid, entity, sourceparams):
   229         """called by the repository after an entity stored here has been
   226         """called by the repository after an entity stored here has been
   230         inserted in the system table.
   227         inserted in the system table.
   274         source = session.repo.sources_by_uri.get(
   271         source = session.repo.sources_by_uri.get(
   275             sourceparams.pop('cwsource', None), self.source)
   272             sourceparams.pop('cwsource', None), self.source)
   276         sourceparams['parser'] = self
   273         sourceparams['parser'] = self
   277         try:
   274         try:
   278             eid = session.repo.extid2eid(source, str(uri), etype, session,
   275             eid = session.repo.extid2eid(source, str(uri), etype, session,
   279                                    sourceparams=sourceparams)
   276                                          complete=False,
       
   277                                          sourceparams=sourceparams)
   280         except ValidationError, ex:
   278         except ValidationError, ex:
   281             self.source.error('error while creating %s: %s', etype, ex)
   279             self.source.error('error while creating %s: %s', etype, ex)
   282             return None
   280             return None
   283         if eid < 0:
   281         if eid < 0:
   284             # entity has been moved away from its original source
   282             # entity has been moved away from its original source