Changeset - 26bc2f02d9cd
[Not reviewed]
default
0 3 0
Mads Kiilerich - 9 years ago 2017-01-22 01:16:52
mads@kiilerich.com
lib: the variable 'request' is usually used for the pylons request object - avoid using it for other purposes
3 files changed with 14 insertions and 14 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/auth_modules/auth_crowd.py
Show inline comments
 
@@ -88,14 +88,14 @@ class CrowdServer(object):
 
        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 = {}
kallithea/lib/middleware/pygrack.py
Show inline comments
 
@@ -91,13 +91,13 @@ class GitRepository(object):
 
        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 @@ class GitRepository(object):
 
        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 @@ class GitRepository(object):
 
        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 @@ class GitRepository(object):
 
        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())
kallithea/lib/recaptcha.py
Show inline comments
 
@@ -76,7 +76,7 @@ def submit(recaptcha_challenge_field, re
 
        '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 @@ def submit(recaptcha_challenge_field, re
 
        }
 
    )
 

	
 
    httpresp = urllib2.urlopen(request)
 
    httpresp = urllib2.urlopen(req)
 

	
 
    return_values = httpresp.read().splitlines()
 
    httpresp.close()
0 comments (0 inline, 0 general)