[Zope-Checkins] SVN: Zope/branches/2.13/src/ZPublisher/HTTPRequest.py revert changes

Nikolay Kim fafhrd91 at gmail.com
Mon Aug 1 15:17:55 EDT 2011


Log message for revision 122437:
  revert changes

Changed:
  U   Zope/branches/2.13/src/ZPublisher/HTTPRequest.py

-=-
Modified: Zope/branches/2.13/src/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/2.13/src/ZPublisher/HTTPRequest.py	2011-08-01 18:14:09 UTC (rev 122436)
+++ Zope/branches/2.13/src/ZPublisher/HTTPRequest.py	2011-08-01 19:17:55 UTC (rev 122437)
@@ -332,13 +332,13 @@
         self.environ = environ
         get_env = environ.get
         self.response = response
-        other = self.other = {'REQUEST': self, 'RESPONSE': response}
+        other = self.other = {'RESPONSE': response}
         self.form = {}
         self.taintedform = {}
         self.steps = []
         self._steps = []
         self._lazies = {}
-        self.debug = DebugFlags()
+        self._debug = DebugFlags()
         # We don't set up the locale initially but just on first access
         self._locale = _marker
 
@@ -379,8 +379,9 @@
         while b and b[0] == '/':
             b = b[1:]
 
-        if 'SERVER_URL' in environ:
-            other['SERVER_URL'] = server_url = environ['SERVER_URL'].strip()
+        server_url = get_env('SERVER_URL',None)
+        if server_url is not None:
+            other['SERVER_URL'] = server_url = server_url.strip()
         else:
             if 'HTTPS' in environ and (
                 environ['HTTPS'] == "on" or environ['HTTPS'] == "ON"):
@@ -1251,9 +1252,11 @@
         categories. The search order is environment variables,
         other variables, form data, and then cookies.
 
-        """
+        """ #"
         other = self.other
         if key in other:
+            if key == 'REQUEST':
+                return self
             return other[key]
 
         if key[:1] == 'U':
@@ -1263,7 +1266,7 @@
                 path = self._script + self._steps
                 n = len(path) - int(n)
                 if n < 0:
-                    return default
+                    raise KeyError, key
                 if pathonly:
                     path = [''] + path[:n]
                 else:
@@ -1281,6 +1284,9 @@
                 return environ[key]
             return ''
 
+        if key == 'REQUEST':
+            return self
+
         if key[:1] == 'B':
             match = BASEmatch(key)
             if match is not None:
@@ -1379,6 +1385,8 @@
                 if self._locale is _marker:
                     self.setupLocale()
                 return self._locale
+            if key == 'debug':
+                return self._debug
             raise AttributeError, key
         return v
 
@@ -1386,10 +1394,12 @@
         self._lazies[key] = callable
 
     def has_key(self, key, returnTaints=0):
-        v = self.get(key, _marker, returnTaints=returnTaints)
-        if v is _marker:
-            return False
-        return True
+        try:
+            self.__getitem__(key, returnTaints=returnTaints)
+        except:
+            return 0
+        else:
+            return 1
 
     def keys(self, returnTaints=0):
         keys = {}



More information about the Zope-Checkins mailing list