diff frontends/src/jp/cmd_blog.py @ 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
parents 62dfa6e02f54
children 301bb52c8715
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 = []