Mercurial > libervia-web
comparison src/pages/u/page_meta.py @ 929:2345577da5ca
pages (u): added u page for user public pages, for now it display blog items
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 16 Apr 2017 18:25:59 +0200 |
parents | |
children | 1c9b6d2c30b5 |
comparison
equal
deleted
inserted
replaced
928:ee243d48100e | 929:2345577da5ca |
---|---|
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 | |
14 | |
15 @defer.inlineCallbacks | |
16 def parse_url(self, request): | |
17 try: | |
18 prof_requested = self.nextPath(request) | |
19 except IndexError: | |
20 self.pageError(request) | |
21 | |
22 data = self.getRData(request) | |
23 | |
24 target_profile = yield self.host.bridge.profileNameGet(prof_requested) | |
25 request.template_data[u'target_profile'] = target_profile | |
26 target_jid = yield self.host.bridge.asyncGetParamA('JabberID', 'Connection', 'value', profile_key=target_profile) | |
27 target_jid = jid.JID(target_jid) | |
28 data[u'service'] = target_jid | |
29 | |
30 | |
31 @defer.inlineCallbacks | |
32 def prepare_render(self, request): | |
33 self.pageRedirect(u'blog', request) |