[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.7

Jim Fulton jim@zope.com
Fri, 7 Feb 2003 10:36:30 -0500


Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv20320

Modified Files:
	http.py 
Log Message:
Added implementation of method attribute.

Removed some decoy code.


=== Zope3/src/zope/publisher/http.py 1.6 => 1.7 ===
--- Zope3/src/zope/publisher/http.py:1.6	Mon Feb  3 10:01:17 2003
+++ Zope3/src/zope/publisher/http.py	Fri Feb  7 10:36:28 2003
@@ -25,6 +25,8 @@
 from zope.publisher.interfaces.http import IHTTPRequest
 from zope.publisher.interfaces.http import IHTTPApplicationRequest
 from zope.publisher.interfaces.http import IHTTPPublisher
+from zope.publisher.interfaces.http import IHTTPPresentation
+
 from zope.publisher.interfaces import Redirect
 from zope.publisher.interfaces.http import IHTTPResponse
 from zope.publisher.interfaces.http import IHTTPApplicationResponse
@@ -258,6 +260,9 @@
     other variables, form data, and then cookies.
     """
 
+    _presentation_type = IHTTPPresentation
+
+
     __implements__ = (BaseRequest.__implements__,
                       IHTTPCredentials, IHTTPRequest, IHTTPApplicationRequest,
                       )
@@ -273,6 +278,7 @@
         '_app_server',    # The server path of the application url
         '_orig_env',      # The original environment
         '_endswithslash', # Does the given path end with /
+        'method',         # The upper-cased request method (REQUEST_METHOD)
         )
 
     retry_max_count = 3    # How many times we're willing to retry
@@ -291,6 +297,8 @@
         else:
             self._auth = None
 
+        self.method = environ.get("REQUEST_METHOD", 'GET').upper()
+
         self._environ = environ
 
         self.__setupCookies()
@@ -900,45 +908,6 @@
         Outputs the response body.
         """
         self.output(self._body)
-
-
-    def _formatException(etype, value, tb, limit=None):
-        import traceback
-        result=['Traceback (innermost last):']
-        if limit is None:
-            if hasattr(sys, 'tracebacklimit'):
-                limit = sys.tracebacklimit
-        n = 0
-        while tb is not None and (limit is None or n < limit):
-            frame = tb.tb_frame
-            lineno = tb.tb_lineno
-            co = frame.f_code
-            filename = co.co_filename
-            name = co.co_name
-            locals = frame.f_locals
-            globals = frame.f_globals
-            modname = globals.get('__name__', filename)
-            result.append('  Module %s, line %d, in %s'
-                          % (modname,lineno,name))
-            try:
-                result.append('    (Object: %s)' %
-                               locals[co.co_varnames[0]].__name__)
-            except:
-                pass
-
-            try:
-                result.append('    (Info: %s)' %
-                               unicode(locals['__traceback_info__']))
-            except: pass
-            tb = tb.tb_next
-            n = n+1
-        result.append(' '.join(traceback.format_exception_only(etype, value)))
-        return result
-
-
-    def _createTracebackString(self, t, v, tb):
-        tb = self._formatException(t, v, tb, 200)
-        return '\n'.join(tb)
 
 
 class DefaultPublisher: