[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - xmlrpc.py:1.16

Chris McDonough chrism@zope.com
Wed, 23 Jul 2003 14:12:31 -0400


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv28521

Modified Files:
	xmlrpc.py 
Log Message:
Fix for Collector 823 (XML RPC exception values were always converted
to strings and thus turned into a Fault object).  Thanks to Sandor Palfy
for the patch.


=== Zope/lib/python/ZPublisher/xmlrpc.py 1.15 => 1.16 ===
--- Zope/lib/python/ZPublisher/xmlrpc.py:1.15	Fri Aug 30 14:29:56 2002
+++ Zope/lib/python/ZPublisher/xmlrpc.py	Wed Jul 23 14:12:26 2003
@@ -126,8 +126,10 @@
         # Don't mask 404 respnses, as some XML-RPC libraries rely on the HTTP
         # mechanisms for detecting when authentication is required. Fixes Zope
         # Collector issue 525.
-        if t == 'Unauthorized' or (isinstance(t, types.ClassType)
-                                   and issubclass(t, Unauthorized)):
+        if t == 'Unauthorized' or (
+            isinstance(t, types.ClassType) and issubclass(t, Unauthorized)
+            ):
+
             return self._real.exception(fatal=fatal, info=info)
 
         # Create an appropriate Fault object. Containing error information
@@ -135,16 +137,16 @@
         f=None
         try:
             # Strip HTML tags from the error value
-            v = str(v)
+            vstr = str(v)
             remove = [r"<[^<>]*>", r"&[A-Za-z]+;"]
             for pat in remove:
-                v = re.sub(pat, " ", v)
+                vstr = re.sub(pat, " ", vstr)
             from Globals import DevelopmentMode
             if DevelopmentMode:
                 from traceback import format_exception
-                value = '\n' + ''.join(format_exception(t, v, tb))
+                value = '\n' + ''.join(format_exception(t, vstr, tb))
             else:
-                value = '%s - %s' % (t, v)
+                value = '%s - %s' % (t, vstr)
                 
             if isinstance(v, Fault):
                 f=v