changeset 1666:dbac3cb19159

quick frontend (blog): replaced mbdata2tags and tags2mbdata by sat.tools.common.dict2iter and iter2dict
author Goffi <goffi@goffi.org>
date Tue, 24 Nov 2015 23:28:11 +0100
parents 14fcbaa82fd4
children bf67dc424784
files frontends/src/quick_frontend/quick_blog.py
diffstat 1 files changed, 2 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_blog.py	Tue Nov 24 19:20:15 2015 +0100
+++ b/frontends/src/quick_frontend/quick_blog.py	Tue Nov 24 23:28:11 2015 +0100
@@ -49,7 +49,7 @@
         self.title = data.get('title')
         self.title_rich = None
         self.title_xhtml = data.get('title_xhtml')
-        self.tags = mbdata2tags(data)
+        self.tags = list(common.dict2iter('tag', data))
         self.content = data.get('content')
         self.content_rich = None
         self.content_xhtml = data.get('content_xhtml')
@@ -261,7 +261,7 @@
                 if value is not None:
                     mb_data[name] = value
 
-        mb_data.update(tags2mbdata(self.item.tags))
+        common.iter2dict('tag', self.item.tags, mb_data)
 
         if self.blog.new_message_target not in (C.PUBLIC, C.GROUP):
             raise NotImplementedError
@@ -462,15 +462,6 @@
     if COMMENTS_CLS is None:
         COMMENTS_CLS = ENTRY_CLS
 
-
-def mbdata2tags(mb_data):
-    """Parse the tags in microblog data.
-
-    @param mb_data (dict): microblog data as return by bridge methods
-    @return list[unicode]
-    """
-    return [tag for key, tag in mb_data.iteritems() if (key == "tag" or key.startswith("tag#")) and tag]
-
 def tags2mbdata(tags):
     """Build from the tags a dict using the microblog data format.