# HG changeset patch # User souliane # Date 1385046314 -3600 # Node ID 886b47896f3cd5a8e7b6fb33f4bdcea1615c9693 # Parent 11718798ab8a6d54c1743a207f546c6c0cd9ec7f browser_side: better PEP8 compliance diff -r 11718798ab8a -r 886b47896f3c browser_side/jid.py --- a/browser_side/jid.py Thu Nov 21 16:03:33 2013 +0100 +++ b/browser_side/jid.py Thu Nov 21 16:05:14 2013 +0100 @@ -20,8 +20,7 @@ """ - -class JID: +class JID(object): """This class help manage JID (Node@Domaine/Resource)""" def __init__(self, jid): @@ -30,19 +29,19 @@ def __parse(self): """find node domaine and resource""" - node_end=self.__raw.find('@') - if node_end<0: - node_end=0 - domain_end=self.__raw.find('/') - if domain_end<1: - domain_end=len(self.__raw) - self.node=self.__raw[:node_end] - self.domain=self.__raw[(node_end+1) if node_end else 0:domain_end] - self.resource=self.__raw[domain_end+1:] + node_end = self.__raw.find('@') + if node_end < 0: + node_end = 0 + domain_end = self.__raw.find('/') + if domain_end < 1: + domain_end = len(self.__raw) + self.node = self.__raw[:node_end] + self.domain = self.__raw[(node_end + 1) if node_end else 0:domain_end] + self.resource = self.__raw[domain_end + 1:] if not node_end: - self.bare=self.__raw + self.bare = self.__raw else: - self.bare=self.node+'@'+self.domain + self.bare = self.node + '@' + self.domain def __str__(self): return self.__raw.__str__() diff -r 11718798ab8a -r 886b47896f3c libervia.py --- a/libervia.py Thu Nov 21 16:03:33 2013 +0100 +++ b/libervia.py Thu Nov 21 16:05:14 2013 +0100 @@ -136,15 +136,14 @@ self.retry_delay = self.RETRY_BASE_DELAY LiberviaJsonProxy.onRemoteResponse(self, response, request_info) - def onRemoteError(self, code, errobj, request_info): if errobj['message'] == 'Empty Response': - Window.getLocation().reload() # XXX: reset page in case of session ended. - # FIXME: Should be done more properly without hard reload + Window.getLocation().reload() # XXX: reset page in case of session ended. + # FIXME: Should be done more properly without hard reload LiberviaJsonProxy.onRemoteError(self, code, errobj, request_info) #we now try to reconnect - if isinstance(errobj['message'],dict) and errobj['message']['faultCode']==0: - Window.alert('You are not allowed to connect to server') + if isinstance(errobj['message'], dict) and errobj['message']['faultCode'] == 0: + Window.alert('You are not allowed to connect to server') else: def _timerCb(): self.host.bridge_signals.call('getSignals', self.host._getSignalsCB) @@ -168,10 +167,10 @@ self.discuss_panel = self.panel.discuss_panel self.tab_panel = self.panel.tab_panel self.tab_panel.addTabListener(self) - self.libervia_widgets = set() #keep track of all actives LiberviaWidgets self.room_list = set() #set of rooms - self.mblog_cache = [] #used to keep our own blog entries in memory, to show them in new mblog panel - self.avatars_cache = {} #keep track of jid's avatar hash (key=jid, value=file) + self.libervia_widgets = set() # keep track of all actives LiberviaWidgets + self.mblog_cache = [] # used to keep our own blog entries in memory, to show them in new mblog panel + self.avatars_cache = {} # keep track of jid's avatar hash (key=jid, value=file) self.current_action_ids = set() #self.discuss_panel.addWidget(panels.EmptyPanel(self)) self.discuss_panel.addWidget(panels.MicroblogPanel(self, []))