Mercurial > libervia-web
annotate src/pages/files/page_meta.py @ 1085:1c09f41e2f52
pages: fixed used of "blog" page instead of "blog_view"
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 02 Apr 2018 09:09:43 +0200 |
parents | 5bf288f84862 |
children | 5d179a3dac50 |
rev | line source |
---|---|
1073 | 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 from sat.core.log import getLogger | |
8 log = getLogger('pages/files') | |
9 """files handling pages""" | |
10 | |
11 name = u'files' | |
12 access = C.PAGES_ACCESS_PROFILE | |
13 template = u"file/discover.html" | |
14 | |
15 | |
16 @defer.inlineCallbacks | |
17 def prepare_render(self, request): | |
18 profile = self.getProfile(request) | |
19 template_data = request.template_data | |
20 namespace = self.host.ns_map['fis'] | |
1076
5bf288f84862
pages (files): change discoFindByFeatures call following backend
Goffi <goffi@goffi.org>
parents:
1073
diff
changeset
|
21 entities_services, entities_own, entities_roster = yield self.host.bridgeCall('discoFindByFeatures', [namespace], [], False, True, True, True, profile) |
1073 | 22 tpl_service_entities = template_data['disco_service_entities'] = {} |
23 tpl_own_entities = template_data['disco_own_entities'] = {} | |
24 tpl_roster_entities = template_data['disco_roster_entities'] = {} | |
25 entities_url = template_data['entities_url'] = {} | |
26 | |
27 # we store identities in dict of dict using category and type as keys | |
28 # this way it's easier to test category in the template | |
29 for tpl_entities, entities_map in ((tpl_service_entities, entities_services), | |
30 (tpl_own_entities, entities_own), | |
31 (tpl_roster_entities, entities_roster)): | |
32 for entity_str, entity_ids in entities_map.iteritems(): | |
33 entity_jid = jid.JID(entity_str) | |
34 tpl_entities[entity_jid] = identities = {} | |
35 for cat, type_, name in entity_ids: | |
36 identities.setdefault(cat, {}).setdefault(type_, []).append(name) | |
37 entities_url[entity_jid] = self.getPageByName('files_list').getURL(entity_jid.full()) | |
38 | |
39 def on_data_post(self, request): | |
40 jid_str = self.getPostedData(request, u'jid') | |
41 try: | |
42 jid_ = jid.JID(jid_str) | |
43 except RuntimeError: | |
44 self.pageError(request, C.HTTP_BAD_REQUEST) | |
45 url = self.getPageByName(u'files_list').getURL(jid_.full()) | |
46 self.HTTPRedirect(request, url) |