diff src/browser/sat_browser/blog.py @ 771:102050e489fa

browser_side (blog): fixes syntax conversion
author souliane <souliane@mailoo.org>
date Thu, 26 Nov 2015 18:31:01 +0100
parents e67d8c13ba22
children 2970b8af3cd7
line wrap: on
line diff
--- a/src/browser/sat_browser/blog.py	Thu Nov 26 13:51:06 2015 +0100
+++ b/src/browser/sat_browser/blog.py	Thu Nov 26 18:31:01 2015 +0100
@@ -243,7 +243,7 @@
             # TODO: if the user change his parameters after the message edition started,
             # the message syntax could be different then the current syntax: pass the
             # message syntax in mb_data for the frontend to use it instead of current syntax.
-            self.item.content_rich = content['text']
+            self.item.content_rich = content['text']  # XXX: this also works if the syntax is XHTML
             self.item.title = content['title']
             self.item.tags = list(common.dict2iter('tag', content))
         else:
@@ -309,14 +309,14 @@
         if self.mode in ENTRY_RICH and not text:
             text = ' ' # something different than empty string is needed to initialize the rich text editor
         self.item.content = text
+        if self.mode in ENTRY_RICH:
+            self.item.content_rich = text  # XXX: this also works if the syntax is XHTML
+            self.bubble.setDisplayContent()  # needed in case the edition is aborted, to not end with an empty bubble
+        else:
+            self.item.content_xhtml = ''
         self.bubble.removeFromParent()
         self._setBubble()
         self.bubble.setOriginalContent(original_content)
-        if self.mode in ENTRY_RICH:
-            self.item.content_xhtml = text
-            self.bubble.setDisplayContent()  # needed in case the edition is aborted, to not end with an empty bubble
-        else:
-            self.item.content_xhtml = ''
 
     def toggleContentSyntax(self):
         """Toggle the editor between raw and rich text"""