# HG changeset patch # User Goffi # Date 1423246552 -3600 # Node ID d78126d82ca02292dfb49967c4bf0c6b8791cca5 # Parent a099990f77a622601d2ffc5ac7ad0c80d797d5d3 browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options) diff -r a099990f77a6 -r d78126d82ca0 src/browser/sat_browser/blog.py --- a/src/browser/sat_browser/blog.py Fri Feb 06 19:11:02 2015 +0100 +++ b/src/browser/sat_browser/blog.py Fri Feb 06 19:15:52 2015 +0100 @@ -215,7 +215,7 @@ self.entry_dialog.setWidth('auto') try: self.toggle_syntax_button.removeFromParent() - except TypeError: + except (AttributeError, TypeError): pass def __setBubble(self, edit=False): @@ -234,7 +234,7 @@ self.bubble.addStyleName("bubble") try: self.toggle_syntax_button.removeFromParent() - except TypeError: + except (AttributeError, TypeError): pass self.entry_dialog.add(self.bubble) self.edit(edit) @@ -297,7 +297,7 @@ entry = self try: entry.toggle_syntax_button.removeFromParent() - except TypeError: + except (AttributeError, TypeError): pass entry.bubble.edit(edit) if edit: @@ -372,6 +372,9 @@ self.vpanel.setStyleName('microblogPanel') self.setWidget(self.vpanel) + def __str__(self): + return u"Blog Widget [target: {}, profile: {}]".format(self.target, self.profile) + @property def target(self): return tuple(self.accepted_groups) @@ -686,13 +689,15 @@ self._accepted_groups = groups self._accepted_groups.sort() - def isJidAccepted(self, jid_s): - """Tell if a jid is actepted and shown in this panel - @param jid_s: jid - @return: True if the jid is accepted""" + def isJidAccepted(self, jid_): + """Tell if a jid is actepted and must be shown in this panel + + @param jid_(jid.JID): jid to check + @return: True if the jid is accepted + """ if self.accept_all(): return True for group in self._accepted_groups: - if self.host.contact_panel.isContactInGroup(group, jid_s): + if self.host.contact_lists[self.profile].isEntityInGroup(jid_, group): return True return False