server/sources/datafeed.py
branchstable
changeset 7731 48e78934a4e2
parent 7727 70ea754d3e04
child 7910 e5d5609e3bf1
child 7921 a93e2ed5877a
equal deleted inserted replaced
7730:8d0edec31aaf 7731:48e78934a4e2
   216         This method must return the an Entity instance representation of this
   216         This method must return the an Entity instance representation of this
   217         entity.
   217         entity.
   218         """
   218         """
   219         entity = super(DataFeedSource, self).before_entity_insertion(
   219         entity = super(DataFeedSource, self).before_entity_insertion(
   220             session, lid, etype, eid, sourceparams)
   220             session, lid, etype, eid, sourceparams)
   221         entity.cw_edited['cwuri'] = unicode(lid)
   221         entity.cw_edited['cwuri'] = lid.decode('utf-8')
   222         entity.cw_edited.set_defaults()
   222         entity.cw_edited.set_defaults()
   223         sourceparams['parser'].before_entity_copy(entity, sourceparams)
   223         sourceparams['parser'].before_entity_copy(entity, sourceparams)
   224         return entity
   224         return entity
   225 
   225 
   226     def after_entity_insertion(self, session, lid, entity, sourceparams):
   226     def after_entity_insertion(self, session, lid, entity, sourceparams):
   273         if source_uri is not None and source_uri != 'system':
   273         if source_uri is not None and source_uri != 'system':
   274             source = session.repo.sources_by_uri.get(source_uri, self.source)
   274             source = session.repo.sources_by_uri.get(source_uri, self.source)
   275         else:
   275         else:
   276             source = self.source
   276             source = self.source
   277         sourceparams['parser'] = self
   277         sourceparams['parser'] = self
       
   278         if isinstance(uri, unicode):
       
   279             uri = uri.encode('utf-8')
   278         try:
   280         try:
   279             eid = session.repo.extid2eid(source, str(uri), etype, session,
   281             eid = session.repo.extid2eid(source, str(uri), etype, session,
   280                                          complete=False, commit=False,
   282                                          complete=False, commit=False,
   281                                          sourceparams=sourceparams)
   283                                          sourceparams=sourceparams)
   282         except ValidationError, ex:
   284         except ValidationError, ex: