# HG changeset patch # User Goffi # Date 1448976413 -3600 # Node ID 103f0f01ba5488eeef9a1d28b605297d3a84e5d4 # Parent f3cd261ea12f10303c1b963749a85b97d3e89954 browser side (blog): fixed entries and comments ordering diff -r f3cd261ea12f -r 103f0f01ba54 src/browser/sat_browser/blog.py --- a/src/browser/sat_browser/blog.py Tue Dec 01 13:55:01 2015 +0100 +++ b/src/browser/sat_browser/blog.py Tue Dec 01 14:26:53 2015 +0100 @@ -192,7 +192,7 @@ def setEditable(self, editable=True): """Toggle the bubble between display and edit mode. - + @param editable (bool) """ self.editable = editable @@ -376,12 +376,10 @@ """Update comments""" self._createCommentsPanel() self.entries.sort(key=lambda entry: entry.item.published, reverse=True) - idx = 0 - for entry in self.entries: + for idx, entry in enumerate(self.entries): if not entry.displayed: self.comments_panel.insert(entry, idx) entry.displayed = True - idx += 1 def delete(self): quick_blog.Entry.delete(self) @@ -436,18 +434,21 @@ def update(self): self.entries.sort(key=lambda entry: entry.item.published, reverse=True) - idx = 0 + start_idx = 0 if self._first_entry is not None: - idx += 1 + start_idx = 1 if not self._first_entry.displayed: self.vpanel.insert(self._first_entry, 0) self._first_entry.displayed = True + # XXX: enumerate is buggued in pyjamas (start is not used) + # we have to use idx + idx = start_idx for entry in self.entries: if not entry.displayed: self.vpanel.insert(entry, idx) entry.displayed = True - idx += 1 + idx += 1 # def onDelete(self): # quick_widgets.QuickWidget.onDelete(self)