[Zope3-checkins] CVS: Zope3/src/zope/publisher - xmlrpc.py:1.4

Stephan Richter srichter@cbu.edu
Tue, 14 Jan 2003 15:26:36 -0500


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

Modified Files:
	xmlrpc.py 
Log Message:
Fixed Error Messages handling for XML-RPC.

Also, noone fixed XML-rPC, when the new view stuff landed. I made it 
similar to VFS, but I need to go back and revisit it, since we do not 
need all this power, for example we do not need named views, since there
will always be just one!


=== Zope3/src/zope/publisher/xmlrpc.py 1.3 => 1.4 ===
--- Zope3/src/zope/publisher/xmlrpc.py:1.3	Fri Dec 27 11:40:25 2002
+++ Zope3/src/zope/publisher/xmlrpc.py	Tue Jan 14 15:26:04 2003
@@ -15,7 +15,7 @@
 
 $Id$
 """
-
+import sys
 import xmlrpclib
 from cgi import FieldStorage
 
@@ -38,6 +38,10 @@
 
     __implements__ = IXMLRPCPublisher
 
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+
 
 class XMLRPCRequest(HTTPRequest):
 
@@ -59,10 +63,10 @@
         # Parse the request XML structure
         self._args, function = xmlrpclib.loads(self._body_instream.read())
         # Translate '.' to '/' in function to represent object traversal.
-        function = function.replace('.', '/')
+        function = function.split('.')
 
         if function:
-            self.setPathSuffix((function,))
+            self.setPathSuffix(function)
 
 
 class TestRequest(XMLRPCRequest):
@@ -123,8 +127,9 @@
                 body = xmlrpclib.False # Argh, XML-RPC doesn't handle null
             try:
                 body = xmlrpclib.dumps((body,), methodresponse=1)
-            except Exception, e:
-                self.handleException(e)
+            except:
+                # We really want to catch all exceptions at this point!
+                self.handleException(sys.exc_info())
                 return
         # Set our body to the XML-RPC message, and fix our MIME type.
         self.setHeader('content-type', 'text/xml')
@@ -139,12 +144,7 @@
     def handleException(self, exc_info):
         """Handle Errors during publsihing and wrap it in XML-RPC XML"""
         t, value = exc_info[:2]
-
-        import traceback
-        traceback.print_tb(exc_info[2])
-        print t
-        print value
-
+            
         # Create an appropriate Fault object. Unfortunately, we throw away
         # most of the debugging information. More useful error reporting is
         # left as an exercise for the reader.