changeset 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 296bda6b7ed0
children 2c2b8c08e6c9
files src/pages/blog/page_meta.py
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/pages/blog/page_meta.py	Mon Mar 26 21:32:16 2018 +0200
+++ b/src/pages/blog/page_meta.py	Tue Mar 27 08:35:37 2018 +0200
@@ -8,7 +8,7 @@
 log = getLogger('pages/common/blog')
 
 name = u'blog'
-access = C.PAGES_ACCESS_PROFILE
+access = C.PAGES_ACCESS_PUBLIC
 template = u"blog/discover.html"
 
 
@@ -16,14 +16,15 @@
 def prepare_render(self, request):
     profile = self.getProfile(request)
     template_data = request.template_data
-    __, entities_own, entities_roster = yield self.host.bridgeCall('discoFindByFeatures', [], [(u'pubsub', u'pep')], True, False, True, True, profile)
-    entities = template_data[u'disco_entities'] = entities_own.keys() + entities_roster.keys()
-    entities_url = template_data[u'entities_url'] = {}
-    identities = template_data[u'identities'] = self.host.getSessionData(request, session_iface.ISATSession).identities
-    for entity_jid_s in entities:
-        entities_url[entity_jid_s] = self.getPageByName('blog_view').getURL(entity_jid_s)
-        if entity_jid_s not in identities:
-            identities[entity_jid_s] = yield self.host.bridgeCall(u'identityGet', entity_jid_s, profile)
+    if profile is not None:
+        __, entities_own, entities_roster = yield self.host.bridgeCall('discoFindByFeatures', [], [(u'pubsub', u'pep')], True, False, True, True, profile)
+        entities = template_data[u'disco_entities'] = entities_own.keys() + entities_roster.keys()
+        entities_url = template_data[u'entities_url'] = {}
+        identities = template_data[u'identities'] = self.host.getSessionData(request, session_iface.ISATSession).identities
+        for entity_jid_s in entities:
+            entities_url[entity_jid_s] = self.getPageByName('blog_view').getURL(entity_jid_s)
+            if entity_jid_s not in identities:
+                identities[entity_jid_s] = yield self.host.bridgeCall(u'identityGet', entity_jid_s, profile)
 
 def on_data_post(self, request):
     jid_str = self.getPostedData(request, u'jid')