--- a/wsgi/request.py Thu May 14 10:24:56 2009 +0200
+++ b/wsgi/request.py Thu May 14 11:38:40 2009 +0200
@@ -5,7 +5,7 @@
http://www.djangoproject.com/
:organization: Logilab
-:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
@@ -25,7 +25,7 @@
class CubicWebWsgiRequest(CubicWebRequestBase):
"""most of this code COMES FROM DJANO
"""
-
+
def __init__(self, environ, vreg, base_url=None):
self.environ = environ
self.path = environ['PATH_INFO']
@@ -42,7 +42,7 @@
self.form.update(files)
# prepare output headers
self.headers_out = {}
-
+
def __repr__(self):
# Since this is called as part of error handling, we need to be very
# robust against potentially malformed input.
@@ -52,14 +52,14 @@
(form, meta)
## cubicweb request interface ################################################
-
+
def base_url(self):
return self._base_url
def http_method(self):
"""returns 'POST', 'GET', 'HEAD', etc."""
return self.method
-
+
def relative_path(self, includeparams=True):
"""return the normalized path of the request (ie at least relative
to the application's root, but some other normalization may be needed
@@ -74,7 +74,7 @@
qs = self.environ.get('QUERY_STRING')
if qs:
return '%s?%s' % (path, qs)
-
+
return path
def get_header(self, header, default=None):
@@ -82,7 +82,7 @@
raise KeyError if the header is not set
"""
return self._headers.get(normalize_header(header), default)
-
+
def set_header(self, header, value, raw=True):
"""set an output HTTP header"""
assert raw, "don't know anything about non-raw headers for wsgi requests"
@@ -91,7 +91,7 @@
def add_header(self, header, value):
"""add an output HTTP header"""
self.headers_out[header] = value
-
+
def remove_header(self, header):
"""remove an output HTTP header"""
self.headers_out.pop(header, None)
@@ -101,9 +101,9 @@
mx date time value (GMT), else return None
"""
return None
-
+
## wsgi request helpers ###################################################
-
+
def application_uri(self):
"""Return the application's base URI (no PATH_INFO or QUERY_STRING)
@@ -123,7 +123,7 @@
url += ':' + environ['SERVER_PORT']
url += quote(environ.get('SCRIPT_NAME') or '/')
return url
-
+
def get_full_path(self):
return '%s%s' % (self.path, self.environ.get('QUERY_STRING', '') and ('?' + self.environ.get('QUERY_STRING', '')) or '')