changeset 2164:63d191c05ecd

jp (blog): set default template and data mapping for the new template output
author Goffi <goffi@goffi.org>
date Tue, 21 Feb 2017 21:01:40 +0100 (2017-02-21)
parents 75667727c500
children a0fbb2b11fd0
files frontends/src/jp/cmd_blog.py frontends/src/jp/cmd_profile.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/cmd_blog.py	Tue Feb 21 21:01:40 2017 +0100
+++ b/frontends/src/jp/cmd_blog.py	Tue Feb 21 21:01:40 2017 +0100
@@ -22,6 +22,7 @@
 from sat.core.i18n import _
 from sat_frontends.jp.constants import Const as C
 from sat.tools.common.ansi import ANSI as A
+from sat.tools.common import data_objects
 from sat.tools import config
 from ConfigParser import NoSectionError, NoOptionError
 import json
@@ -188,6 +189,7 @@
 
 
 class Get(base.CommandBase):
+    TEMPLATE = u"blog/articles.html"
 
     def __init__(self, host):
         extra_outputs = {'default': self.default_output,
@@ -207,6 +209,9 @@
                                  help=_(u"JID of the PubSub service (default: request profile own blog)"))
         # TODO: add MAM filters
 
+    def template_data_mapping(self, data):
+        return {u'items': data_objects.BlogItems(data)}
+
     def format_comments(self, item, keys):
         comments_data = data_format.dict2iterdict(u'comments', item, (u'node', u'service'), pop=True)
         lines = []
--- a/frontends/src/jp/cmd_profile.py	Tue Feb 21 21:01:40 2017 +0100
+++ b/frontends/src/jp/cmd_profile.py	Tue Feb 21 21:01:40 2017 +0100
@@ -20,7 +20,8 @@
 """This module permits to manage profiles. It can list, create, delete
 and retrieve information about a profile."""
 
-import logging as log
+from sat.core.log import getLogger
+log = getLogger(__name__)
 from sat.core.i18n import _
 from sat_frontends.jp import base