comparison src/pages/blog/page_meta.py @ 1079:3af28f84ce91

pages (blog): blog page is now public (only free jid is available when not connected)
author Goffi <goffi@goffi.org>
date Tue, 27 Mar 2018 08:35:37 +0200
parents 880ea673aaff
children ff503f23ac37
comparison
equal deleted inserted replaced
1078:296bda6b7ed0 1079:3af28f84ce91
6 from libervia.server import session_iface 6 from libervia.server import session_iface
7 from sat.core.log import getLogger 7 from sat.core.log import getLogger
8 log = getLogger('pages/common/blog') 8 log = getLogger('pages/common/blog')
9 9
10 name = u'blog' 10 name = u'blog'
11 access = C.PAGES_ACCESS_PROFILE 11 access = C.PAGES_ACCESS_PUBLIC
12 template = u"blog/discover.html" 12 template = u"blog/discover.html"
13 13
14 14
15 @defer.inlineCallbacks 15 @defer.inlineCallbacks
16 def prepare_render(self, request): 16 def prepare_render(self, request):
17 profile = self.getProfile(request) 17 profile = self.getProfile(request)
18 template_data = request.template_data 18 template_data = request.template_data
19 __, entities_own, entities_roster = yield self.host.bridgeCall('discoFindByFeatures', [], [(u'pubsub', u'pep')], True, False, True, True, profile) 19 if profile is not None:
20 entities = template_data[u'disco_entities'] = entities_own.keys() + entities_roster.keys() 20 __, entities_own, entities_roster = yield self.host.bridgeCall('discoFindByFeatures', [], [(u'pubsub', u'pep')], True, False, True, True, profile)
21 entities_url = template_data[u'entities_url'] = {} 21 entities = template_data[u'disco_entities'] = entities_own.keys() + entities_roster.keys()
22 identities = template_data[u'identities'] = self.host.getSessionData(request, session_iface.ISATSession).identities 22 entities_url = template_data[u'entities_url'] = {}
23 for entity_jid_s in entities: 23 identities = template_data[u'identities'] = self.host.getSessionData(request, session_iface.ISATSession).identities
24 entities_url[entity_jid_s] = self.getPageByName('blog_view').getURL(entity_jid_s) 24 for entity_jid_s in entities:
25 if entity_jid_s not in identities: 25 entities_url[entity_jid_s] = self.getPageByName('blog_view').getURL(entity_jid_s)
26 identities[entity_jid_s] = yield self.host.bridgeCall(u'identityGet', entity_jid_s, profile) 26 if entity_jid_s not in identities:
27 identities[entity_jid_s] = yield self.host.bridgeCall(u'identityGet', entity_jid_s, profile)
27 28
28 def on_data_post(self, request): 29 def on_data_post(self, request):
29 jid_str = self.getPostedData(request, u'jid') 30 jid_str = self.getPostedData(request, u'jid')
30 try: 31 try:
31 jid_ = jid.JID(jid_str) 32 jid_ = jid.JID(jid_str)