# HG changeset patch # User Mads Kiilerich # Date 1485044212 -3600 # Node ID 26bc2f02d9cdcd8aa3ae424effe4bd33b0972d39 # Parent 0122959e1f1d53a733a2758ddb54438b1cdb5343 lib: the variable 'request' is usually used for the pylons request object - avoid using it for other purposes diff -r 0122959e1f1d -r 26bc2f02d9cd kallithea/lib/auth_modules/auth_crowd.py --- a/kallithea/lib/auth_modules/auth_crowd.py Sat Jan 14 21:22:51 2017 +0100 +++ b/kallithea/lib/auth_modules/auth_crowd.py Sun Jan 22 01:16:52 2017 +0100 @@ -88,14 +88,14 @@ log.debug("Sent crowd: \n%s", formatted_json({"url": url, "body": body, "headers": _headers})) - request = urllib2.Request(url, body, _headers) + req = urllib2.Request(url, body, _headers) if method: - request.get_method = lambda: method + req.get_method = lambda: method global msg msg = "" try: - rdoc = self.opener.open(request) + rdoc = self.opener.open(req) msg = "".join(rdoc.readlines()) if not msg and empty_response_ok: rval = {} diff -r 0122959e1f1d -r 26bc2f02d9cd kallithea/lib/middleware/pygrack.py --- a/kallithea/lib/middleware/pygrack.py Sat Jan 14 21:22:51 2017 +0100 +++ b/kallithea/lib/middleware/pygrack.py Sun Jan 22 01:16:52 2017 +0100 @@ -91,13 +91,13 @@ assert path.startswith('/' + self.repo_name + '/') return path[len(self.repo_name) + 2:].strip('/') - def inforefs(self, request, environ): + def inforefs(self, req, environ): """ WSGI Response producer for HTTP GET Git Smart HTTP /info/refs request. """ - git_command = request.GET.get('service') + git_command = req.GET.get('service') if git_command not in self.commands: log.debug('command %s not allowed', git_command) return exc.HTTPMethodNotAllowed() @@ -131,7 +131,7 @@ resp.app_iter = out return resp - def backend(self, request, environ): + def backend(self, req, environ): """ WSGI Response producer for HTTP POST Git Smart HTTP requests. Reads commands and data from HTTP POST's body. @@ -139,14 +139,14 @@ response to stdout """ _git_path = kallithea.CONFIG.get('git_path', 'git') - git_command = self._get_fixedpath(request.path_info) + git_command = self._get_fixedpath(req.path_info) if git_command not in self.commands: log.debug('command %s not allowed', git_command) return exc.HTTPMethodNotAllowed() if 'CONTENT_LENGTH' in environ: inputstream = FileWrapper(environ['wsgi.input'], - request.content_length) + req.content_length) else: inputstream = environ['wsgi.input'] @@ -182,14 +182,14 @@ return resp def __call__(self, environ, start_response): - request = Request(environ) - _path = self._get_fixedpath(request.path_info) + req = Request(environ) + _path = self._get_fixedpath(req.path_info) if _path.startswith('info/refs'): app = self.inforefs - elif [a for a in self.valid_accepts if a in request.accept]: + elif [a for a in self.valid_accepts if a in req.accept]: app = self.backend try: - resp = app(request, environ) + resp = app(req, environ) except exc.HTTPException as e: resp = e log.error(traceback.format_exc()) diff -r 0122959e1f1d -r 26bc2f02d9cd kallithea/lib/recaptcha.py --- a/kallithea/lib/recaptcha.py Sat Jan 14 21:22:51 2017 +0100 +++ b/kallithea/lib/recaptcha.py Sun Jan 22 01:16:52 2017 +0100 @@ -76,7 +76,7 @@ 'response': encode_if_necessary(recaptcha_response_field), }) - request = urllib2.Request( + req = urllib2.Request( url="http://%s/recaptcha/api/verify" % VERIFY_SERVER, data=params, headers={ @@ -85,7 +85,7 @@ } ) - httpresp = urllib2.urlopen(request) + httpresp = urllib2.urlopen(req) return_values = httpresp.read().splitlines() httpresp.close()