# HG changeset patch # User Goffi # Date 1448404091 -3600 # Node ID dbac3cb191599538c81173c82d3931894eb2a919 # Parent 14fcbaa82fd42f1db93fc3db08b215b9903ad3a5 quick frontend (blog): replaced mbdata2tags and tags2mbdata by sat.tools.common.dict2iter and iter2dict diff -r 14fcbaa82fd4 -r dbac3cb19159 frontends/src/quick_frontend/quick_blog.py --- 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.