comparison libervia/pages/u/page_meta.py @ 1124:28e3eb3bb217

files reorganisation and installation rework: - files have been reorganised to follow other SàT projects and usual Python organisation (no more "/src" directory) - VERSION file is now used, as for other SàT projects - replace the overcomplicated setup.py be a more sane one. Pyjamas part is not compiled anymore by setup.py, it must be done separatly - removed check for data_dir if it's empty - installation tested working in virtual env - libervia launching script is now in bin/libervia
author Goffi <goffi@goffi.org>
date Sat, 25 Aug 2018 17:59:48 +0200
parents src/pages/u/page_meta.py@cdd389ef97bc
children 4e716967893a
comparison
equal deleted inserted replaced
1123:63a4b8fe9782 1124:28e3eb3bb217
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 twisted.words.protocols.jabber import jid
7
8 """page used to target a user profile, e.g. for public blog"""
9
10 name = u"user"
11 access = C.PAGES_ACCESS_PUBLIC # can be a callable
12 template = u"blog/articles.html"
13 url_cache = True
14
15
16 @defer.inlineCallbacks
17 def parse_url(self, request):
18 try:
19 prof_requested = self.nextPath(request)
20 except IndexError:
21 self.pageError(request)
22
23 data = self.getRData(request)
24
25 target_profile = yield self.host.bridgeCall("profileNameGet", prof_requested)
26 request.template_data[u"target_profile"] = target_profile
27 target_jid = yield self.host.bridgeCall(
28 "asyncGetParamA", "JabberID", "Connection", "value", profile_key=target_profile
29 )
30 target_jid = jid.JID(target_jid)
31 data[u"service"] = target_jid
32
33
34 @defer.inlineCallbacks
35 def prepare_render(self, request):
36 data = self.getRData(request)
37 self.checkCache(
38 request, C.CACHE_PUBSUB, service=data[u"service"], node=None, short="microblog"
39 )
40 self.pageRedirect(u"blog_view", request)