# HG changeset patch # User souliane # Date 1448112876 -3600 # Node ID d123e27fc386e9a73ea47b69fc1e73b0da128681 # Parent c3cb68227cca38622d0396b5a4fdba6c8bc9f03c browser_side: use methods defined in quick_frontend to retrieve and set the tags from/to microblog data diff -r c3cb68227cca -r d123e27fc386 src/browser/sat_browser/richtext.py --- a/src/browser/sat_browser/richtext.py Thu Nov 19 17:20:37 2015 +0100 +++ b/src/browser/sat_browser/richtext.py Sat Nov 21 14:34:36 2015 +0100 @@ -39,7 +39,7 @@ import html_tools import list_manager -from sat_frontends.quick_frontend import quick_list_manager +from sat_frontends.quick_frontend import quick_blog class RichTextEditor(editor_widget.BaseTextEditor, FlexTable): @@ -266,10 +266,7 @@ if hasattr(self, 'title_panel'): content.update({'title': self.strproc(self.title_panel.getText())}) if hasattr(self, 'tags_panel'): - count = 0 - for tag in self.tags_panel.getTags(): - content['tag#%i' % count if count else 'tag'] = tag - count += 1 + content.update(quick_blog.tags2mbdata(self.tags_panel.getTags())) return content def edit(self, edit=False, abort=False, sync=False): @@ -305,8 +302,8 @@ self.title_panel.setText(content['title']) self.title_panel.setStackVisible(0, content['title'] != '') - if hasattr(self, 'tags_panel') and 'tag' in content: - tags = [tag for key, tag in content.iteritems() if (key == "tag" or key.startswith("tag#")) and tag] + if hasattr(self, 'tags_panel'): + tags = quick_blog.mbdata2tags(content) self.tags_panel.setTags(tags) self.tags_panel.setStackVisible(0, len(tags) > 0) @@ -328,8 +325,8 @@ text = content['text'] if 'title' in content and content['title']: text = '

%s

%s' % (html_tools.html_sanitize(content['title']), text) - if 'tag' in content: # FIXME: display it more beautiful - tags = [tag for key, tag in content.iteritems() if (key == "tag" or key.startswith("tag#")) and tag] + tags = quick_blog.mbdata2tags(content) + if tags: # FIXME: display it more beautiful text = '%s

%s %s

' % (text, _("Tags:"), html_tools.html_sanitize(", ".join(tags))) self.display.setContent({'text': text})