diff src/server/blog.py @ 885:12e0bfdfe9c6

blog: fixed forgotten encode with urllib.quote
author Goffi <goffi@goffi.org>
date Wed, 09 Mar 2016 21:21:15 +0100
parents 763da94ba28b
children fe4d8dfaaa65
line wrap: on
line diff
--- a/src/server/blog.py	Wed Mar 09 20:40:27 2016 +0100
+++ b/src/server/blog.py	Wed Mar 09 21:21:15 2016 +0100
@@ -430,7 +430,7 @@
             link_blog_elt['type'] = u'application/xmpp+xml'
             link_blog_elt['href'] = blog_xmpp_uri
 
-            feed_elt.addElement('id', content=urllib.quote(blog_xmpp_uri))
+            feed_elt.addElement('id', content=urllib.quote(blog_xmpp_uri.encode('utf-8')))
             updated_unix = max([float(item['updated']) for item in items])
             updated_dt = datetime.fromtimestamp(updated_unix)
             feed_elt.addElement(u'updated', u'{}Z'.format(updated_dt.isoformat("T")))
@@ -450,7 +450,7 @@
                 http_link_elt = entry_elt.addElement(u'link')
                 http_link_elt['rel'] = u'alternate'
                 http_link_elt['type'] = u'text/html'
-                http_link_elt['href'] = u'{base}/{quoted_id}'.format(base=base_blog_url, quoted_id=urllib.quote(item['id']))
+                http_link_elt['href'] = u'{base}/{quoted_id}'.format(base=base_blog_url, quoted_id=urllib.quote(item['id'].encode('utf-8')))
                 # XMPP link
                 xmpp_link_elt = entry_elt.addElement(u'link')
                 xmpp_link_elt['rel'] = u'alternate'
@@ -574,7 +574,7 @@
             # FIXME: that's really not a good way to get item id
             #        this must be changed after static blog refactorisation
             item_id = items[0][0]['id']
-            xmpp_uri+=u";item={}".format(urllib.quote(item_id))
+            xmpp_uri+=u";item={}".format(urllib.quote(item_id.encode('utf-8')))
 
         data = {'url_base': base_url,
                 'xmpp_uri': xmpp_uri,