comparison src/server/blog.py @ 760:78caef6ed8e7

static blog: replaced mbdata2tags by sat.tools.common.dict2iter
author Goffi <goffi@goffi.org>
date Tue, 24 Nov 2015 23:31:41 +0100
parents 7168a9873dde
children f0ad3f62bae2
comparison
equal deleted inserted replaced
759:34f066ed3b23 760:78caef6ed8e7
20 20
21 from sat.core.i18n import _, D_ 21 from sat.core.i18n import _, D_
22 from sat_frontends.tools.strings import addURLToText 22 from sat_frontends.tools.strings import addURLToText
23 from sat.core.log import getLogger 23 from sat.core.log import getLogger
24 log = getLogger(__name__) 24 log = getLogger(__name__)
25 25 from sat.tools import common
26 from dbus.exceptions import DBusException 26 from dbus.exceptions import DBusException
27 from twisted.internet import defer 27 from twisted.internet import defer
28 from twisted.web import server 28 from twisted.web import server
29 from twisted.web.resource import Resource 29 from twisted.web.resource import Resource
30 from twisted.words.protocols.jabber.jid import JID 30 from twisted.words.protocols.jabber.jid import JID
33 from sys import path 33 from sys import path
34 import uuid 34 import uuid
35 import re 35 import re
36 import os 36 import os
37 37
38 from sat_frontends.quick_frontend import quick_blog
39 from libervia.server.html_tools import sanitizeHtml, convertNewLinesToXHTML 38 from libervia.server.html_tools import sanitizeHtml, convertNewLinesToXHTML
40 from libervia.server.constants import Const as C 39 from libervia.server.constants import Const as C
41 40
42 41
43 NS_MICROBLOG = 'urn:xmpp:microblog:0' 42 NS_MICROBLOG = 'urn:xmpp:microblog:0'
470 self.author = (_("from %s") % entry['author']) 469 self.author = (_("from %s") % entry['author'])
471 else: 470 else:
472 self.author = '&nbsp;' 471 self.author = '&nbsp;'
473 self.url = (u"%s/%s" % (base_url, entry['id'])) 472 self.url = (u"%s/%s" % (base_url, entry['id']))
474 self.title = self.getText(entry, 'title') 473 self.title = self.getText(entry, 'title')
475 self.tags = quick_blog.mbdata2tags(entry) 474 self.tags = list(common.dict2iter('tag', entry))
476 475
477 count_text = lambda count: D_('comments') if count > 1 else D_('comment') 476 count_text = lambda count: D_('comments') if count > 1 else D_('comment')
478 477
479 self.comments_text = "%s %s" % (comments_count, count_text(comments_count)) 478 self.comments_text = "%s %s" % (comments_count, count_text(comments_count))
480 479