annotate pages/news/page_meta.py @ 12:0d6ae55579a5

presentation: added docker instructions + updated bullet points at the end.
author Goffi <goffi@goffi.org>
date Fri, 23 Apr 2021 11:04:38 +0200
parents dc880664a8ec
children 5fd933e238bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 from libervia.server.constants import Const as C
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 from twisted.words.protocols.jabber import jid
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 from sat.core.i18n import _
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 from sat.core.log import getLogger
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 log = getLogger(__name__)
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
8 name = "news"
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
9 template = "news/news.html"
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 service = None
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11 node = None
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
8
dc880664a8ec modernisation of the theme using Bulma
Goffi <goffi@goffi.org>
parents: 6
diff changeset
14 async def prepare_render(self, request):
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 global service, node
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 if service is None:
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
17 blog_dict = self.getConfig('news_blog_dict', {})
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 try:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19 service = jid.JID(blog_dict['service'])
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 except RuntimeError as e:
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
21 log.warning(_("Can't parse service in news_blog_dict: {e}").format(e=e))
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 service = None
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 except KeyError:
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
24 log.warnning(_("Missing service in news_blog_dict"))
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 service = None
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
26 node = blog_dict.get('node', '')
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 if not blog_dict or service is None:
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
28 log.warning(_('No value set for news_blog_dict, "news" page can\'t be used'))
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 self.pageError(request, C.HTTP_SERVICE_UNAVAILABLE)
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
30
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 data = self.getRData(request)
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
32 data['service'] = service
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
33 data['node'] = node
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
34
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 # self.checkCache(
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 # request, C.CACHE_PUBSUB, service=service, node=node, short="microblog")
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
37
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 # we now need blog items, using blog common page
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 # this will fill the "items" template data
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
40 blog_page = self.getPageByName("blog_view")
8
dc880664a8ec modernisation of the theme using Bulma
Goffi <goffi@goffi.org>
parents: 6
diff changeset
41 await blog_page.prepare_render(self, request)