jp (blog): set default template and data mapping for the new template output

This commit is contained in:
Goffi 2017-02-21 21:01:40 +01:00
commit a1def7f8f0
2 changed files with 7 additions and 1 deletions

View file

@ -22,6 +22,7 @@ import base
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 BlogCommon(object):
class Get(base.CommandBase):
TEMPLATE = u"blog/articles.html"
def __init__(self, host):
extra_outputs = {'default': self.default_output,
@ -207,6 +209,9 @@ class Get(base.CommandBase):
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 = []

View file

@ -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