diff frontends/src/quick_frontend/quick_app.py @ 1326:88e40f31b17e frontends_multi_profiles

quick_frontend (quick_app): fixes the call to a bridge method that was done with a JID instead of unicode
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 13:58:33 +0100
parents 49f967fc87aa
children f8bd40509a2d
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Sat Feb 21 17:22:39 2015 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Sun Feb 22 13:58:33 2015 +0100
@@ -29,6 +29,13 @@
 from sat_frontends.quick_frontend.constants import Const as C
 
 
+try:
+    # FIXME: to be removed when an acceptable solution is here
+    unicode('')  # XXX: unicode doesn't exist in pyjamas
+except (TypeError, AttributeError):  # Error raised is not the same depending on pyjsbuild options
+    unicode = str
+
+
 class ProfileManager(object):
     """Class managing all data relative to one profile, and plugging in mechanism"""
     host = None
@@ -601,10 +608,8 @@
 
     def _subscribe_cb(self, answer, data):
         entity, profile = data
-        if answer:
-            self.bridge.subscription("subscribed", entity.bare, profile_key=profile)
-        else:
-            self.bridge.subscription("unsubscribed", entity.bare, profile_key=profile)
+        type_ = "subscribed" if answer else "unsubscribed"
+        self.bridge.subscription(type_, unicode(entity.bare), profile_key=profile)
 
     def subscribeHandler(self, type, raw_jid, profile):
         """Called when a subsciption management signal is received"""