summaryrefslogtreecommitdiff
path: root/paste/recursive.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-10-20 22:08:05 +0000
committerianb <devnull@localhost>2006-10-20 22:08:05 +0000
commit44fa5352360b78696c3d81cafa8e24eaa4f6c3ed (patch)
treeccde2c446f352cb5344f3c9a40090f12290bf9a7 /paste/recursive.py
parent9eadab4b64440958f99a2fa1798227bb4a53193c (diff)
downloadpaste-44fa5352360b78696c3d81cafa8e24eaa4f6c3ed.tar.gz
A big commit, primarily aesthetic/whitespace in nature. This is the result of running pylint over the codebase. Some minor/hard-to-reach typos were also picked up.
Diffstat (limited to 'paste/recursive.py')
-rw-r--r--paste/recursive.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/paste/recursive.py b/paste/recursive.py
index a56c174..81661c6 100644
--- a/paste/recursive.py
+++ b/paste/recursive.py
@@ -24,7 +24,6 @@ Raise ``ForwardRequestException(new_path_info)`` to do a forward
"""
from cStringIO import StringIO
-from urlparse import urlparse
import warnings
__all__ = ['RecursiveMiddleware']
@@ -43,7 +42,8 @@ class CheckForRecursionMiddleware:
"Forwarding loop detected; %r visited twice (internal "
"redirect path: %s)"
% (path_info, self.env['paste.recursive.old_path_info']))
- self.env.setdefault('paste.recursive.old_path_info', []).append(self.env.get('PATH_INFO', ''))
+ old_path_info = self.env.setdefault('paste.recursive.old_path_info', [])
+ old_path_info.append(self.env.get('PATH_INFO', ''))
return self.app(environ, start_response)
class RecursiveMiddleware(object):
@@ -75,12 +75,13 @@ class RecursiveMiddleware(object):
environ,
start_response)
my_script_name = environ.get('SCRIPT_NAME', '')
- current_path_info = environ.get('PATH_INFO', '')
environ['paste.recursive.script_name'] = my_script_name
try:
return self.application(environ, start_response)
except ForwardRequestException, e:
- return CheckForRecursionMiddleware(e.factory(self), environ)(environ, start_response)
+ middleware = CheckForRecursionMiddleware(
+ e.factory(self), environ)
+ return middleware(environ, start_response)
class ForwardRequestException(Exception):
"""
@@ -169,15 +170,20 @@ class ForwardRequestException(Exception):
url=None,
environ={},
factory=None,
- path_info=None,
- ):
+ path_info=None):
# Check no incompatible options have been chosen
if factory and url:
- raise TypeError('You cannot specify factory and a url in ForwardRequestException')
+ raise TypeError(
+ 'You cannot specify factory and a url in '
+ 'ForwardRequestException')
elif factory and environ:
- raise TypeError('You cannot specify factory and environ in ForwardRequestException')
+ raise TypeError(
+ 'You cannot specify factory and environ in '
+ 'ForwardRequestException')
if url and environ:
- raise TypeError('You cannot specify environ and url in ForwardRequestException')
+ raise TypeError(
+ 'You cannot specify environ and url in '
+ 'ForwardRequestException')
# set the path_info or warn about its use.
if path_info:
@@ -258,6 +264,9 @@ class Recursive(object):
environ['REQUEST_METHOD'] = 'GET'
return self.activate(environ)
+ def activate(self, environ):
+ raise NotImplementedError
+
def __repr__(self):
return '<%s.%s from %s>' % (
self.__class__.__module__,