comparison src/browser/sat_browser/blog.py @ 662:ebb602d8b3f2 frontends_multi_profiles

browser_side: replace all instances of 'str' with 'unicode'
author souliane <souliane@mailoo.org>
date Tue, 03 Mar 2015 06:51:13 +0100
parents e1d067378ad3
children 166f3b624816
comparison
equal deleted inserted replaced
661:2664fe93ceb3 662:ebb602d8b3f2
164 self.comment_label = addIcon(u"↶", "Comment this message") 164 self.comment_label = addIcon(u"↶", "Comment this message")
165 self.comment_label.setStyleName('mb_entry_action_larger') 165 self.comment_label.setStyleName('mb_entry_action_larger')
166 is_publisher = self.author == self._blog_panel.host.whoami.bare 166 is_publisher = self.author == self._blog_panel.host.whoami.bare
167 if is_publisher: 167 if is_publisher:
168 self.update_label = addIcon(u"✍", "Edit this message") 168 self.update_label = addIcon(u"✍", "Edit this message")
169 if is_publisher or str(self.node).endswith(unicode(self._blog_panel.host.whoami.bare)): 169 if is_publisher or unicode(self.node).endswith(unicode(self._blog_panel.host.whoami.bare)):
170 self.delete_label = addIcon(u"✗", "Delete this message") 170 self.delete_label = addIcon(u"✗", "Delete this message")
171 171
172 def updateAvatar(self, new_avatar): 172 def updateAvatar(self, new_avatar):
173 """Change the avatar of the entry 173 """Change the avatar of the entry
174 @param new_avatar: path to the new image""" 174 @param new_avatar: path to the new image"""
189 @return: False to restore the original content if a deletion has been cancelled 189 @return: False to restore the original content if a deletion has been cancelled
190 """ 190 """
191 if not content['text']: # previous content has been emptied 191 if not content['text']: # previous content has been emptied
192 self._delete(True) 192 self._delete(True)
193 return False 193 return False
194 extra = {'published': str(self.published)} 194 extra = {'published': unicode(self.published)}
195 if isinstance(self.bubble, richtext.RichTextEditor): 195 if isinstance(self.bubble, richtext.RichTextEditor):
196 # TODO: if the user change his parameters after the message edition started, 196 # TODO: if the user change his parameters after the message edition started,
197 # the message syntax could be different then the current syntax: pass the 197 # the message syntax could be different then the current syntax: pass the
198 # message syntax in extra for the frontend to use it instead of current syntax. 198 # message syntax in extra for the frontend to use it instead of current syntax.
199 extra.update({'content_rich': content['text'], 'title': content['title']}) 199 extra.update({'content_rich': content['text'], 'title': content['title']})
273 """Add an empty entry for a new comment""" 273 """Add an empty entry for a new comment"""
274 if self._current_comment: 274 if self._current_comment:
275 self._current_comment.bubble.setFocus(True) 275 self._current_comment.bubble.setFocus(True)
276 self._blog_panel.setSelectedEntry(self._current_comment, True) 276 self._blog_panel.setSelectedEntry(self._current_comment, True)
277 return 277 return
278 data = {'id': str(time()), 278 data = {'id': unicode(time()),
279 'new': True, 279 'new': True,
280 'type': 'comment', 280 'type': 'comment',
281 'author': unicode(self._blog_panel.host.whoami.bare), 281 'author': unicode(self._blog_panel.host.whoami.bare),
282 'service': self.comments_service, 282 'service': self.comments_service,
283 'node': self.comments_node 283 'node': self.comments_node
406 return 406 return
407 if self.host.uni_box is None: 407 if self.host.uni_box is None:
408 def addBox(): 408 def addBox():
409 if hasattr(self, 'new_button'): 409 if hasattr(self, 'new_button'):
410 self.new_button.setVisible(False) 410 self.new_button.setVisible(False)
411 data = {'id': str(time()), 411 data = {'id': unicode(time()),
412 'new': True, 412 'new': True,
413 'author': unicode(self.host.whoami.bare), 413 'author': unicode(self.host.whoami.bare),
414 } 414 }
415 entry = self.addEntry(data) 415 entry = self.addEntry(data)
416 entry.edit(True) 416 entry.edit(True)