comparison src/pages/g/e/page_meta.py @ 943:aacda981c348

pages (g/e): use blog_uri from event instead of guest's main uri
author Goffi <goffi@goffi.org>
date Fri, 19 May 2017 13:54:49 +0200
parents 6b55d038b121
children d076b722ca52
comparison
equal deleted inserted replaced
942:6b55d038b121 943:aacda981c348
17 @defer.inlineCallbacks 17 @defer.inlineCallbacks
18 def prepare_render(self, request): 18 def prepare_render(self, request):
19 template_data = request.template_data 19 template_data = request.template_data
20 guest_session = self.host.getSessionData(request, session_iface.ISATGuestSession) 20 guest_session = self.host.getSessionData(request, session_iface.ISATGuestSession)
21 try: 21 try:
22 main_uri = guest_session.data['main_uri']
23 event_uri = guest_session.data['event_uri'] 22 event_uri = guest_session.data['event_uri']
24 except KeyError: 23 except KeyError:
25 log.warning(_(u"main or event URI not found, can't render event page")) 24 log.warning(_(u"event URI not found, can't render event page"))
26 self.pageError(request, C.HTTP_SERVICE_UNAVAILABLE) 25 self.pageError(request, C.HTTP_SERVICE_UNAVAILABLE)
27 26
28 data = self.getRData(request) 27 data = self.getRData(request)
29 28
30 ## Event ## 29 ## Event ##
52 profile) 51 profile)
53 template_data['invitee'] = event_invitee_data 52 template_data['invitee'] = event_invitee_data
54 53
55 ## Blog ## 54 ## Blog ##
56 55
57 main_uri_data = uri.parseXMPPUri(main_uri) 56 data[u'service'] = jid.JID(event_data[u'blog_service'])
58 if main_uri_data[u'type'] != u'pubsub' or main_uri_data.get('sub_type') != 'microblog': 57 data[u'node'] = event_data[u'blog_node']
59 self.pageError(request, C.HTTP_SERVICE_UNAVAILABLE)
60
61 data[u'service'] = jid.JID(main_uri_data[u'path'])
62 data[u'node'] = main_uri_data[u'node']
63 58
64 # we now need blog items, using blog common page 59 # we now need blog items, using blog common page
65 # this will fill the "items" template data 60 # this will fill the "items" template data
66 blog_page = self.getPageByName(u'blog') 61 blog_page = self.getPageByName(u'blog')
67 yield blog_page.prepare_render(self, request) 62 yield blog_page.prepare_render(self, request)