comparison 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
comparison
equal deleted inserted replaced
884:763da94ba28b 885:12e0bfdfe9c6
428 link_blog_elt = feed_elt.addElement('link') 428 link_blog_elt = feed_elt.addElement('link')
429 link_blog_elt['rel'] = u'alternate' 429 link_blog_elt['rel'] = u'alternate'
430 link_blog_elt['type'] = u'application/xmpp+xml' 430 link_blog_elt['type'] = u'application/xmpp+xml'
431 link_blog_elt['href'] = blog_xmpp_uri 431 link_blog_elt['href'] = blog_xmpp_uri
432 432
433 feed_elt.addElement('id', content=urllib.quote(blog_xmpp_uri)) 433 feed_elt.addElement('id', content=urllib.quote(blog_xmpp_uri.encode('utf-8')))
434 updated_unix = max([float(item['updated']) for item in items]) 434 updated_unix = max([float(item['updated']) for item in items])
435 updated_dt = datetime.fromtimestamp(updated_unix) 435 updated_dt = datetime.fromtimestamp(updated_unix)
436 feed_elt.addElement(u'updated', u'{}Z'.format(updated_dt.isoformat("T"))) 436 feed_elt.addElement(u'updated', u'{}Z'.format(updated_dt.isoformat("T")))
437 437
438 for item in items: 438 for item in items:
448 448
449 # HTTP link 449 # HTTP link
450 http_link_elt = entry_elt.addElement(u'link') 450 http_link_elt = entry_elt.addElement(u'link')
451 http_link_elt['rel'] = u'alternate' 451 http_link_elt['rel'] = u'alternate'
452 http_link_elt['type'] = u'text/html' 452 http_link_elt['type'] = u'text/html'
453 http_link_elt['href'] = u'{base}/{quoted_id}'.format(base=base_blog_url, quoted_id=urllib.quote(item['id'])) 453 http_link_elt['href'] = u'{base}/{quoted_id}'.format(base=base_blog_url, quoted_id=urllib.quote(item['id'].encode('utf-8')))
454 # XMPP link 454 # XMPP link
455 xmpp_link_elt = entry_elt.addElement(u'link') 455 xmpp_link_elt = entry_elt.addElement(u'link')
456 xmpp_link_elt['rel'] = u'alternate' 456 xmpp_link_elt['rel'] = u'alternate'
457 xmpp_link_elt['type'] = u'application/xmpp+xml' 457 xmpp_link_elt['type'] = u'application/xmpp+xml'
458 xmpp_link_elt['href'] = u'{blog_uri};item={item_id}'.format(blog_uri=blog_xmpp_uri, item_id=item['id']) 458 xmpp_link_elt['href'] = u'{blog_uri};item={item_id}'.format(blog_uri=blog_xmpp_uri, item_id=item['id'])
572 xmpp_uri = metadata['uri'] 572 xmpp_uri = metadata['uri']
573 if len(items) == 1: 573 if len(items) == 1:
574 # FIXME: that's really not a good way to get item id 574 # FIXME: that's really not a good way to get item id
575 # this must be changed after static blog refactorisation 575 # this must be changed after static blog refactorisation
576 item_id = items[0][0]['id'] 576 item_id = items[0][0]['id']
577 xmpp_uri+=u";item={}".format(urllib.quote(item_id)) 577 xmpp_uri+=u";item={}".format(urllib.quote(item_id.encode('utf-8')))
578 578
579 data = {'url_base': base_url, 579 data = {'url_base': base_url,
580 'xmpp_uri': xmpp_uri, 580 'xmpp_uri': xmpp_uri,
581 'url_query': u'?{}'.format(query_data) if query_data else '' , 581 'url_query': u'?{}'.format(query_data) if query_data else '' ,
582 'keywords': getOption(C.STATIC_BLOG_PARAM_KEYWORDS), 582 'keywords': getOption(C.STATIC_BLOG_PARAM_KEYWORDS),