Mercurial > libervia-web
changeset 274:886b47896f3c
browser_side: better PEP8 compliance
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 21 Nov 2013 16:05:14 +0100 (2013-11-21) |
parents | 11718798ab8a |
children | a763b2ac5d41 |
files | browser_side/jid.py libervia.py |
diffstat | 2 files changed, 19 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- 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__()
--- 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, []))