[datafeed] properly encode/decode external uri stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 03 Aug 2011 18:16:02 +0200
branchstable
changeset 7731 48e78934a4e2
parent 7730 8d0edec31aaf
child 7732 5430d0db52ab
[datafeed] properly encode/decode external uri
server/sources/datafeed.py
--- a/server/sources/datafeed.py	Tue Aug 02 17:37:55 2011 +0200
+++ b/server/sources/datafeed.py	Wed Aug 03 18:16:02 2011 +0200
@@ -218,7 +218,7 @@
         """
         entity = super(DataFeedSource, self).before_entity_insertion(
             session, lid, etype, eid, sourceparams)
-        entity.cw_edited['cwuri'] = unicode(lid)
+        entity.cw_edited['cwuri'] = lid.decode('utf-8')
         entity.cw_edited.set_defaults()
         sourceparams['parser'].before_entity_copy(entity, sourceparams)
         return entity
@@ -275,6 +275,8 @@
         else:
             source = self.source
         sourceparams['parser'] = self
+        if isinstance(uri, unicode):
+            uri = uri.encode('utf-8')
         try:
             eid = session.repo.extid2eid(source, str(uri), etype, session,
                                          complete=False, commit=False,