Commit 995ffadc authored by Nikolay Kim's avatar Nikolay Kim

revert changes

parent 0a28612a
...@@ -332,13 +332,13 @@ class HTTPRequest(BaseRequest): ...@@ -332,13 +332,13 @@ class HTTPRequest(BaseRequest):
self.environ = environ self.environ = environ
get_env = environ.get get_env = environ.get
self.response = response self.response = response
other = self.other = {'REQUEST': self, 'RESPONSE': response} other = self.other = {'RESPONSE': response}
self.form = {} self.form = {}
self.taintedform = {} self.taintedform = {}
self.steps = [] self.steps = []
self._steps = [] self._steps = []
self._lazies = {} self._lazies = {}
self.debug = DebugFlags() self._debug = DebugFlags()
# We don't set up the locale initially but just on first access # We don't set up the locale initially but just on first access
self._locale = _marker self._locale = _marker
...@@ -379,8 +379,9 @@ class HTTPRequest(BaseRequest): ...@@ -379,8 +379,9 @@ class HTTPRequest(BaseRequest):
while b and b[0] == '/': while b and b[0] == '/':
b = b[1:] b = b[1:]
if 'SERVER_URL' in environ: server_url = get_env('SERVER_URL',None)
other['SERVER_URL'] = server_url = environ['SERVER_URL'].strip() if server_url is not None:
other['SERVER_URL'] = server_url = server_url.strip()
else: else:
if 'HTTPS' in environ and ( if 'HTTPS' in environ and (
environ['HTTPS'] == "on" or environ['HTTPS'] == "ON"): environ['HTTPS'] == "on" or environ['HTTPS'] == "ON"):
...@@ -1251,9 +1252,11 @@ class HTTPRequest(BaseRequest): ...@@ -1251,9 +1252,11 @@ class HTTPRequest(BaseRequest):
categories. The search order is environment variables, categories. The search order is environment variables,
other variables, form data, and then cookies. other variables, form data, and then cookies.
""" """ #"
other = self.other other = self.other
if key in other: if key in other:
if key == 'REQUEST':
return self
return other[key] return other[key]
if key[:1] == 'U': if key[:1] == 'U':
...@@ -1263,7 +1266,7 @@ class HTTPRequest(BaseRequest): ...@@ -1263,7 +1266,7 @@ class HTTPRequest(BaseRequest):
path = self._script + self._steps path = self._script + self._steps
n = len(path) - int(n) n = len(path) - int(n)
if n < 0: if n < 0:
return default raise KeyError, key
if pathonly: if pathonly:
path = [''] + path[:n] path = [''] + path[:n]
else: else:
...@@ -1281,6 +1284,9 @@ class HTTPRequest(BaseRequest): ...@@ -1281,6 +1284,9 @@ class HTTPRequest(BaseRequest):
return environ[key] return environ[key]
return '' return ''
if key == 'REQUEST':
return self
if key[:1] == 'B': if key[:1] == 'B':
match = BASEmatch(key) match = BASEmatch(key)
if match is not None: if match is not None:
...@@ -1379,6 +1385,8 @@ class HTTPRequest(BaseRequest): ...@@ -1379,6 +1385,8 @@ class HTTPRequest(BaseRequest):
if self._locale is _marker: if self._locale is _marker:
self.setupLocale() self.setupLocale()
return self._locale return self._locale
if key == 'debug':
return self._debug
raise AttributeError, key raise AttributeError, key
return v return v
...@@ -1386,10 +1394,12 @@ class HTTPRequest(BaseRequest): ...@@ -1386,10 +1394,12 @@ class HTTPRequest(BaseRequest):
self._lazies[key] = callable self._lazies[key] = callable
def has_key(self, key, returnTaints=0): def has_key(self, key, returnTaints=0):
v = self.get(key, _marker, returnTaints=returnTaints) try:
if v is _marker: self.__getitem__(key, returnTaints=returnTaints)
return False except:
return True return 0
else:
return 1
def keys(self, returnTaints=0): def keys(self, returnTaints=0):
keys = {} keys = {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment