diff options
| author | ianb <devnull@localhost> | 2005-08-22 21:11:50 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-08-22 21:11:50 +0000 |
| commit | a171c7d41358b02b3a1859732318bb1fde82fcd7 (patch) | |
| tree | df23a0f3712044eb1fbb6a1a8e665e69956df76e /tests/urlparser_data/not_found | |
| parent | c77d41d16bfadbfbba203a65ac5777545958755d (diff) | |
| download | paste-a171c7d41358b02b3a1859732318bb1fde82fcd7.tar.gz | |
Moved test
Diffstat (limited to 'tests/urlparser_data/not_found')
| -rw-r--r-- | tests/urlparser_data/not_found/__init__.py | 1 | ||||
| -rw-r--r-- | tests/urlparser_data/not_found/recur/__init__.py | 9 | ||||
| -rw-r--r-- | tests/urlparser_data/not_found/recur/isfound.txt | 1 | ||||
| -rw-r--r-- | tests/urlparser_data/not_found/simple/__init__.py | 3 | ||||
| -rw-r--r-- | tests/urlparser_data/not_found/simple/found.txt | 1 | ||||
| -rw-r--r-- | tests/urlparser_data/not_found/user/__init__.py | 12 | ||||
| -rw-r--r-- | tests/urlparser_data/not_found/user/list.py | 3 |
7 files changed, 30 insertions, 0 deletions
diff --git a/tests/urlparser_data/not_found/__init__.py b/tests/urlparser_data/not_found/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/tests/urlparser_data/not_found/__init__.py @@ -0,0 +1 @@ +# diff --git a/tests/urlparser_data/not_found/recur/__init__.py b/tests/urlparser_data/not_found/recur/__init__.py new file mode 100644 index 0000000..48205a5 --- /dev/null +++ b/tests/urlparser_data/not_found/recur/__init__.py @@ -0,0 +1,9 @@ +def not_found_hook(environ, start_response): + urlparser = environ['paste.urlparser.not_found_parser'] + path = environ.get('PATH_INFO', '') + if not path: + return urlparser.not_found(environ, start_response) + # Strip off leading _'s + path = '/' + path.lstrip('/').lstrip('_') + environ['PATH_INFO'] = path + return urlparser(environ, start_response) diff --git a/tests/urlparser_data/not_found/recur/isfound.txt b/tests/urlparser_data/not_found/recur/isfound.txt new file mode 100644 index 0000000..c8b8fab --- /dev/null +++ b/tests/urlparser_data/not_found/recur/isfound.txt @@ -0,0 +1 @@ +is found diff --git a/tests/urlparser_data/not_found/simple/__init__.py b/tests/urlparser_data/not_found/simple/__init__.py new file mode 100644 index 0000000..f1e7faa --- /dev/null +++ b/tests/urlparser_data/not_found/simple/__init__.py @@ -0,0 +1,3 @@ +def not_found_hook(environ, start_response): + start_response('200 OK', [('Content-type', 'text/plain')]) + return ['not found'] diff --git a/tests/urlparser_data/not_found/simple/found.txt b/tests/urlparser_data/not_found/simple/found.txt new file mode 100644 index 0000000..c8b8fab --- /dev/null +++ b/tests/urlparser_data/not_found/simple/found.txt @@ -0,0 +1 @@ +is found diff --git a/tests/urlparser_data/not_found/user/__init__.py b/tests/urlparser_data/not_found/user/__init__.py new file mode 100644 index 0000000..c47f88e --- /dev/null +++ b/tests/urlparser_data/not_found/user/__init__.py @@ -0,0 +1,12 @@ +from paste import wsgilib + +def not_found_hook(environ, start_response): + urlparser = environ['paste.urlparser.not_found_parser'] + first, rest = wsgilib.path_info_split(environ.get('PATH_INFO', '')) + if not first: + # No username + return + environ['app.user'] = first + environ['SCRIPT_NAME'] += '/' + first + environ['PATH_INFO'] = rest + return urlparser(environ, start_response) diff --git a/tests/urlparser_data/not_found/user/list.py b/tests/urlparser_data/not_found/user/list.py new file mode 100644 index 0000000..f6228f0 --- /dev/null +++ b/tests/urlparser_data/not_found/user/list.py @@ -0,0 +1,3 @@ +def application(environ, start_response): + start_response('200 OK', [('Content-type', 'text/plain')]) + return ['user: %s' % environ.get('app.user')] |
