comparison src/server/blog.py @ 881:6bdee34fa2f4

server: added base_url_ext option to handle different external URLs (e.g.: if there is a proxy)
author Goffi <goffi@goffi.org>
date Wed, 09 Mar 2016 18:38:52 +0100
parents ccbad50e1426
children d3d2b97aa12c
comparison
equal deleted inserted replaced
880:ccbad50e1426 881:6bdee34fa2f4
397 # from microblog data 397 # from microblog data
398 items, metadata= data 398 items, metadata= data
399 feed_elt = domish.Element((NS_ATOM, u'feed')) 399 feed_elt = domish.Element((NS_ATOM, u'feed'))
400 title = _(u"{user}'s blog").format(user=profile) 400 title = _(u"{user}'s blog").format(user=profile)
401 feed_elt.addElement(u'title', content=title) 401 feed_elt.addElement(u'title', content=title)
402 url_path = request.URLPath() 402 if self.host.base_url_ext is not None:
403 base_blog_url = u"{0.scheme}://{0.netloc}/blog/{user}".format(url_path, user=profile) 403 base_blog_url = u"{}blog/{user}".format(self.host.base_url_ext, user=profile)
404 else:
405 url_path = request.URLPath()
406 base_blog_url = u"{0.scheme}://{0.netloc}/blog/{user}".format(url_path, user=profile)
404 407
405 # atom link 408 # atom link
406 link_feed_elt = feed_elt.addElement('link') 409 link_feed_elt = feed_elt.addElement('link')
407 link_feed_elt['href'] = u'{base}/atom.xml'.format(base=base_blog_url) 410 link_feed_elt['href'] = u'{base}/atom.xml'.format(base=base_blog_url)
408 link_feed_elt['type'] = u'application/atom+xml' 411 link_feed_elt['type'] = u'application/atom+xml'