Mercurial > libervia-web
comparison src/server/server.py @ 482:437eefa53a01
misc: remove some pylint errors and warnings
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 15 Jun 2014 18:16:24 +0200 |
parents | bbdc5357dc00 |
children | e588335b6aa8 |
comparison
equal
deleted
inserted
replaced
481:bbdc5357dc00 | 482:437eefa53a01 |
---|---|
179 profile = ISATSession(self.session).profile | 179 profile = ISATSession(self.session).profile |
180 if not profile: | 180 if not profile: |
181 #user is not identified, we return a jsonrpc fault | 181 #user is not identified, we return a jsonrpc fault |
182 parsed = jsonrpclib.loads(request.content.read()) | 182 parsed = jsonrpclib.loads(request.content.read()) |
183 fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia | 183 fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia |
184 return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) | 184 return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) # pylint: disable=E1103 |
185 return jsonrpc.JSONRPC.render(self, request) | 185 return jsonrpc.JSONRPC.render(self, request) |
186 | 186 |
187 def jsonrpc_getProfileJid(self): | 187 def jsonrpc_getProfileJid(self): |
188 """Return the jid of the profile""" | 188 """Return the jid of the profile""" |
189 sat_session = ISATSession(self.session) | 189 sat_session = ISATSession(self.session) |
578 """ | 578 """ |
579 if request.postpath == ['login']: | 579 if request.postpath == ['login']: |
580 return self.loginOrRegister(request) | 580 return self.loginOrRegister(request) |
581 _session = request.getSession() | 581 _session = request.getSession() |
582 parsed = jsonrpclib.loads(request.content.read()) | 582 parsed = jsonrpclib.loads(request.content.read()) |
583 method = parsed.get("method") | 583 method = parsed.get("method") # pylint: disable=E1103 |
584 if method not in ['isRegistered', 'registerParams', 'getMenus']: | 584 if method not in ['isRegistered', 'registerParams', 'getMenus']: |
585 #if we don't call these methods, we need to be identified | 585 #if we don't call these methods, we need to be identified |
586 profile = ISATSession(_session).profile | 586 profile = ISATSession(_session).profile |
587 if not profile: | 587 if not profile: |
588 #user is not identified, we return a jsonrpc fault | 588 #user is not identified, we return a jsonrpc fault |
589 fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia | 589 fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia |
590 return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) | 590 return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) # pylint: disable=E1103 |
591 self.request = request | 591 self.request = request |
592 return jsonrpc.JSONRPC.render(self, request) | 592 return jsonrpc.JSONRPC.render(self, request) |
593 | 593 |
594 def loginOrRegister(self, request): | 594 def loginOrRegister(self, request): |
595 """This method is called with the POST information from the registering form. | 595 """This method is called with the POST information from the registering form. |
853 def genericCb(*args): | 853 def genericCb(*args): |
854 profile = args[-1] | 854 profile = args[-1] |
855 if not profile in self.sat_host.prof_connected: | 855 if not profile in self.sat_host.prof_connected: |
856 return | 856 return |
857 if profile in self.signalDeferred: | 857 if profile in self.signalDeferred: |
858 self.signalDeferred[profile].callback((function_name,args[:-1])) | 858 self.signalDeferred[profile].callback((function_name, args[:-1])) |
859 del self.signalDeferred[profile] | 859 del self.signalDeferred[profile] |
860 else: | 860 else: |
861 if profile not in self.queue: | 861 if profile not in self.queue: |
862 self.queue[profile] = [] | 862 self.queue[profile] = [] |
863 self.queue[profile].append((function_name, args[:-1])) | 863 self.queue[profile].append((function_name, args[:-1])) |
890 parsed = jsonrpclib.loads(request.content.read()) | 890 parsed = jsonrpclib.loads(request.content.read()) |
891 profile = ISATSession(_session).profile | 891 profile = ISATSession(_session).profile |
892 if not profile: | 892 if not profile: |
893 #user is not identified, we return a jsonrpc fault | 893 #user is not identified, we return a jsonrpc fault |
894 fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia | 894 fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia |
895 return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) | 895 return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) # pylint: disable=E1103 |
896 self.request = request | 896 self.request = request |
897 return jsonrpc.JSONRPC.render(self, request) | 897 return jsonrpc.JSONRPC.render(self, request) |
898 | 898 |
899 | 899 |
900 class UploadManager(Resource): | 900 class UploadManager(Resource): |
1016 ['ssl_certificate', 'c', 'libervia.pem', _(u'PEM certificate with both private and public parts.').encode('utf-8'), str], | 1016 ['ssl_certificate', 'c', 'libervia.pem', _(u'PEM certificate with both private and public parts.').encode('utf-8'), str], |
1017 ['redirect_to_https', 'r', 1, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), int], | 1017 ['redirect_to_https', 'r', 1, _(u'Automatically redirect from HTTP to HTTPS.').encode('utf-8'), int], |
1018 ['security_warning', 'w', 1, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), int], | 1018 ['security_warning', 'w', 1, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), int], |
1019 ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str], | 1019 ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str], |
1020 ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir], | 1020 ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir], |
1021 ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html | 1021 ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html |
1022 OPT_PARAMETERS_CFG = [['empty_password_allowed_warning_dangerous_list', None, '', None]] # Options which are in sat.conf only | 1022 OPT_PARAMETERS_CFG = [['empty_password_allowed_warning_dangerous_list', None, '', None]] # Options which are in sat.conf only |
1023 | 1023 |
1024 def __init__(self, *args, **kwargs): | 1024 def __init__(self, *args, **kwargs): |
1025 self.initialised = defer.Deferred() | 1025 self.initialised = defer.Deferred() |
1026 | 1026 |
1027 # options managing | 1027 # options managing |