diff src/browser/sat_browser/blog.py @ 651:2df91d0308ac frontends_multi_profiles

browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
author souliane <souliane@mailoo.org>
date Fri, 27 Feb 2015 01:08:36 +0100
parents 6d3142b782c3
children 0262fee86375
line wrap: on
line diff
--- a/src/browser/sat_browser/blog.py	Fri Feb 27 00:56:08 2015 +0100
+++ b/src/browser/sat_browser/blog.py	Fri Feb 27 01:08:36 2015 +0100
@@ -437,20 +437,18 @@
         return first if first.empty else None
 
     @staticmethod
-    def onGroupDrop(host, item):
-        """Generic panel creation for one, several or all groups (meta).
+    def onGroupDrop(host, targets):
+        """Create a microblog panel for one, several or all contact groups.
 
         @param host (SatWebFrontend): the SatWebFrontend instance
-        @param item: single group as a string, list of groups
-         (as an array) or None (for the meta group = "all groups")
+        @param targets (tuple(unicode)): tuple of groups (empty for "all groups")
         @return: the created MicroblogPanel
         """
-        items_ = tuple(item) if isinstance(item, list) else (() if item is None else (item,))
-        type_ = 'ALL' if items_ == () else 'GROUP'
+        type_ = 'ALL' if not targets else 'GROUP'
         # XXX: pyjamas doesn't support use of cls directly
-        widget = host.displayWidget(MicroblogPanel, items_, dropped=True)
+        widget = host.displayWidget(MicroblogPanel, targets, dropped=True)
         host.FillMicroblogPanel(widget)
-        host.bridge.getMassiveLastMblogs(type_, items_, 10, profile=C.PROF_KEY_NONE, callback=widget.massiveInsert)
+        host.bridge.getMassiveLastMblogs(type_, targets, 10, profile=C.PROF_KEY_NONE, callback=widget.massiveInsert)
         widget.refresh() # FIXME: needed ?
         return widget
 
@@ -735,7 +733,7 @@
         return False
 
 
-libervia_widget.LiberviaWidget.addDropKey("GROUP", MicroblogPanel.onGroupDrop)
+libervia_widget.LiberviaWidget.addDropKey("GROUP", lambda host, item: MicroblogPanel.onGroupDrop(host, (item,)))
 
 # Needed for the drop keys to not be mixed between meta panel and panel for "Contacts" group
-libervia_widget.LiberviaWidget.addDropKey("CONTACT_TITLE", lambda host, item: MicroblogPanel.onGroupDrop(host, None))
+libervia_widget.LiberviaWidget.addDropKey("CONTACT_TITLE", lambda host, item: MicroblogPanel.onGroupDrop(host, ()))