comparison src/pages/blog/view/atom.xml/page_meta.py @ 1083:ff503f23ac37

pages: fixed calls to "blog" instead of "blog_view"
author Goffi <goffi@goffi.org>
date Fri, 30 Mar 2018 20:31:47 +0200
parents src/pages/blog/atom.xml/page_meta.py@880ea673aaff
children cdd389ef97bc
comparison
equal deleted inserted replaced
1082:8d8b88bfddad 1083:ff503f23ac37
1 #!/usr/bin/env python2.7
2 # -*- coding: utf-8 -*-
3
4 from libervia.server.constants import Const as C
5 from twisted.internet import defer
6 from sat.tools.common import uri
7 import time
8
9 name = u"blog_feed_atom"
10 access = C.PAGES_ACCESS_PUBLIC
11 template = u"blog/atom.xml"
12
13
14 @defer.inlineCallbacks
15 def prepare_render(self, request):
16 request.setHeader('Content-Type', 'application/atom+xml; charset=utf-8')
17 data = self.getRData(request)
18 service, node = data[u'service'], data.get(u'node')
19 self.checkCache(request, C.CACHE_PUBSUB, service=service, node=node, short='microblog')
20 data['show_comments'] = False
21 template_data = request.template_data
22 blog_page = self.getPageByName(u'blog_view')
23 yield blog_page.prepare_render(self, request)
24 items = data[u'items']
25
26 template_data[u'request_uri'] = self.host.getExtBaseURL(request, request.path.decode('utf-8'))
27 template_data[u'xmpp_uri'] = uri.buildXMPPUri(u'pubsub',
28 subtype=u'microblog',
29 path=service.full(),
30 node=node)
31 blog_view = self.getPageByName(u'blog_view')
32 template_data[u'http_uri'] = self.host.getExtBaseURL(request, blog_view.getURL(service.full(), node))
33 if items:
34 template_data[u'updated'] = items[0].updated
35 else:
36 template_data[u'updated'] = time.time()