[Zope-Checkins] CVS: Zope2 - HTTPRequest.py:1.54

andreas@serenade.digicool.com andreas@serenade.digicool.com
Thu, 31 May 2001 10:54:32 -0400


Update of /cvs-repository/Zope2/lib/python/ZPublisher
In directory serenade:/tmp/cvs-serv24951/lib/python/ZPublisher

Modified Files:
	HTTPRequest.py 
Log Message:
added text() method for Request objects to provide
a textual representation of the object
(Collector #2264)



--- Updated File HTTPRequest.py in package Zope2 --
--- HTTPRequest.py	2001/04/27 20:27:58	1.53
+++ HTTPRequest.py	2001/05/31 14:54:32	1.54
@@ -960,6 +960,34 @@
 
     __repr__=__str__
 
+    def text(self):
+        result="FORM\n\n"
+        row='%-20s %s\n'
+        for k,v in self.form.items():
+            result=result + row % (k, repr(v))
+        result=result+"\nCOOKIES\n\n"
+        for k,v in self.cookies.items():
+            result=result + row % (k, repr(v))
+        result=result+"\nOTHER\n\n"
+        for k,v in self.other.items():
+            if k in ('PARENTS','RESPONSE'): continue
+            result=result + row % (k, repr(v))
+    
+        for n in "0123456789":
+            key = "URL%s"%n
+            try: result=result + row % (key, self[key]) 
+            except KeyError: pass
+        for n in "0123456789":
+            key = "BASE%s"%n
+            try: result=result + row % (key, self[key]) 
+            except KeyError: pass
+
+        result=result+"\nENVIRON\n\n"
+        for k,v in self.environ.items():
+            if not hide_key(k):
+                result=result + row % (k, v)
+        return result
+
     def _authUserPW(self):
         global base64
         auth=self._auth