class ConnectionManager: def __init__(self,host,port): self.proxy = SkoleSYS_Client(host,port) def _get_proxy_handle(self): counter = 0 # Check if it is nessecary to request a new session id # the SOAP server may have flushed the session info if not self.proxy.test_session_id(): self.proxy._get_id() while not self.proxy.test_binded() and counter<3: username,passwd = loginwdg.get_credentials() if username==None: # Login was cancelled sys.exit(0) bindres = self.proxy.bind(username,passwd) if type(bindres) == bool and bindres==True: self.binded_user = username break if type(bindres) == int and bindres==-9999: # Acess denied accesstools.access_denied_dialog('access.soap.bind') sys.exit(0) counter+=1 if counter>=3: print "The connection manager has cut this session from further use" sys.exit(0) return self.proxy
class ConnectionManager: def __init__(self,host,port): self.proxy = SkoleSYS_Client(host,port) def get_proxy_handle(self): counter = 0 while not self.proxy.test_binded() and counter<3: passwd = QInputDialog.getText(qApp.translate("General","SkoleSYS Administration"), qApp.translate("General","Enter administrator password"), QLineEdit.Password) if passwd[1]==False: sys.exit(0) if self.proxy.bind(str(passwd[0].utf8())): break counter+=1 if counter>=3: print "The connection manager has cut this session from further use" sys.exit(0) return self.proxy