summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paste/session.py3
-rw-r--r--paste/url.py6
-rw-r--r--paste/urlparser.py18
-rw-r--r--paste/wsgilib.py2
4 files changed, 15 insertions, 14 deletions
diff --git a/paste/session.py b/paste/session.py
index 8c85af8..fba386c 100644
--- a/paste/session.py
+++ b/paste/session.py
@@ -31,6 +31,7 @@ try:
except ImportError:
import pickle as cPickle
import wsgilib
+import request
class SessionMiddleware(object):
@@ -70,7 +71,7 @@ class SessionFactory(object):
self.used = True
if self.session is not None:
return self.session.data()
- cookies = wsgilib.get_cookies(self.environ)
+ cookies = request.get_cookies(self.environ)
session = None
if cookies.has_key(self.cookie_name):
self.sid = cookies[self.cookie_name].value
diff --git a/paste/url.py b/paste/url.py
index a0cc727..eecbba9 100644
--- a/paste/url.py
+++ b/paste/url.py
@@ -6,7 +6,7 @@ This module implements a class for handling URLs.
"""
import urllib
import cgi
-from paste import wsgilib
+from paste import request
# Imported lazily from FormEncode:
variabledecode = None
@@ -75,13 +75,13 @@ class URLResource(object):
def from_environ(cls, environ, with_query_string=True,
with_path_info=True, script_name=None,
path_info=None, querystring=None):
- url = wsgilib.construct_url(
+ url = request.construct_url(
environ, with_query_string=False,
with_path_info=with_path_info, script_name=script_name,
path_info=path_info)
if with_query_string:
if querystring is None:
- vars = wsgilib.parse_querystring(environ)
+ vars = request.parse_querystring(environ)
else:
vars = cgi.parse_qsl(
querystring,
diff --git a/paste/urlparser.py b/paste/urlparser.py
index 3c380b6..4f8c950 100644
--- a/paste/urlparser.py
+++ b/paste/urlparser.py
@@ -143,7 +143,7 @@ class URLParser(object):
environ['SCRIPT_NAME'] = orig_script_name
return not_found_hook(environ, start_response)
if filename is None:
- name, rest_of_path = wsgilib.path_info_split(environ['PATH_INFO'])
+ name, rest_of_path = request.path_info_split(environ['PATH_INFO'])
if not name:
name = 'one of %s' % ', '.join(
self.index_names or
@@ -174,7 +174,7 @@ class URLParser(object):
and not environ.get('paste.urlparser.init_application') == environ['SCRIPT_NAME']):
environ['paste.urlparser.init_application'] = environ['SCRIPT_NAME']
return self.init_module.application, None
- name, rest_of_path = wsgilib.path_info_split(environ['PATH_INFO'])
+ name, rest_of_path = request.path_info_split(environ['PATH_INFO'])
environ['PATH_INFO'] = rest_of_path
if name is not None:
environ['SCRIPT_NAME'] = environ.get('SCRIPT_NAME', '') + '/' + name
@@ -197,7 +197,7 @@ class URLParser(object):
def not_found(self, environ, start_response, debug_message=None):
exc = httpexceptions.HTTPNotFound(
'The resource at %s could not be found'
- % wsgilib.construct_url(environ),
+ % request.construct_url(environ),
comment='SCRIPT_NAME=%r; PATH_INFO=%r; looking in %r; debug: %s'
% (environ.get('SCRIPT_NAME'), environ.get('PATH_INFO'),
self.directory, debug_message or '(none)'))
@@ -208,7 +208,7 @@ class URLParser(object):
This happens when you try to get to a directory
without a trailing /
"""
- url = wsgilib.construct_url(environ, with_query_string=False)
+ url = request.construct_url(environ, with_query_string=False)
url += '/'
if environ.get('QUERY_STRING'):
url += '?' + environ['QUERY_STRING']
@@ -248,7 +248,7 @@ class URLParser(object):
else:
environ['wsgi.errors'].write(
'Ambiguous URL: %s; matches files %s\n'
- % (wsgilib.construct_url(environ),
+ % (request.construct_url(environ),
', '.join(possible)))
return None
return possible[0]
@@ -430,14 +430,14 @@ class StaticURLParser(object):
return self.__class__(full)(environ, start_response)
if environ.get('PATH_INFO') and environ.get('PATH_INFO') != '/':
return self.error_extra_path(environ, start_response)
- return wsgilib.send_file(full)(environ, start_response)
+ return request.send_file(full)(environ, start_response)
def add_slash(self, environ, start_response):
"""
This happens when you try to get to a directory
without a trailing /
"""
- url = wsgilib.construct_url(environ, with_query_string=False)
+ url = request.construct_url(environ, with_query_string=False)
url += '/'
if environ.get('QUERY_STRING'):
url += '?' + environ['QUERY_STRING']
@@ -493,7 +493,7 @@ class PkgResourcesParser(StaticURLParser):
# @@: This should obviously be configurable
filename = 'index.html'
else:
- filename = wsgilib.path_info_pop(environ)
+ filename = request.path_info_pop(environ)
resource = self.resource_name + '/' + filename
if not self.egg.has_resource(resource):
return self.not_found(environ, start_response)
@@ -520,7 +520,7 @@ class PkgResourcesParser(StaticURLParser):
def not_found(self, environ, start_response, debug_message=None):
exc = httpexceptions.HTTPNotFound(
'The resource at %s could not be found'
- % wsgilib.construct_url(environ),
+ % request.construct_url(environ),
comment='SCRIPT_NAME=%r; PATH_INFO=%r; looking in egg:%s#%r; debug: %s'
% (environ.get('SCRIPT_NAME'), environ.get('PATH_INFO'),
self.egg, self.resource_name, debug_message or '(none)'))
diff --git a/paste/wsgilib.py b/paste/wsgilib.py
index 8d9dc9d..b0af4e8 100644
--- a/paste/wsgilib.py
+++ b/paste/wsgilib.py
@@ -388,7 +388,7 @@ def capture_output(environ, start_response, application):
warnings.warn(
'wsgilib.capture_output has been deprecated in favor '
'of wsgilib.intercept_output',
- DeprecationWarning, 1)
+ DeprecationWarning, 2)
data = []
output = StringIO()
def replacement_start_response(status, headers, exc_info=None):