Mercurial > libervia-web
diff src/pages/blog_new/page_meta.py @ 1016:fc1c913cc9d1
pages (blog_new, common/blog): various blog improvments:
- item_id can now be specified in URL parsing, and a filter_keyword is used so future variants can be implemented (e.g. tags)
- if item_id is specified, rsm is discarded and only the requested item is retrieved
- new template data "items_http_uri" is filled, with links to HTTP versions of items
- blog_new is now a simple redirection to common/blog as the later should be generic enough to handle all use cases.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Jan 2018 18:09:39 +0100 |
parents | d042f194624a |
children |
line wrap: on
line diff
--- a/src/pages/blog_new/page_meta.py Fri Jan 19 18:01:58 2018 +0100 +++ b/src/pages/blog_new/page_meta.py Fri Jan 19 18:09:39 2018 +0100 @@ -1,39 +1,5 @@ #!/usr/bin/env python2.7 # -*- coding: utf-8 -*- -from libervia.server.constants import Const as C -from twisted.internet import defer -from twisted.words.protocols.jabber import jid -from sat.tools.common import data_objects - name = u"blog_view" -access = C.PAGES_ACCESS_PUBLIC # can be a callable -template = u"blog/articles.html" - -@defer.inlineCallbacks -def parse_url(self, request): - try: - prof_requested = self.nextPath(request) - except IndexError: - self.pageError(request) - - template_data = request.template_data - - target_profile = yield self.host.bridge.profileNameGet(prof_requested) - template_data[u'target_profile'] = target_profile - target_jid = yield self.host.bridge.asyncGetParamA('JabberID', 'Connection', 'value', profile_key=target_profile) - target_jid = jid.JID(target_jid).userhost() - template_data[u'target_jid'] = target_jid - - -@defer.inlineCallbacks -def prepare_render(self, request): - target_jid = request.template_data[u'target_jid'] - blog_data = yield self.host.bridge.mbGet( - target_jid, - "", - 10, - [], - {}, - C.SERVICE_PROFILE) - request.template_data[u'items'] = data_objects.BlogItems(blog_data) +redirect = u"blog"