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

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


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

Modified Files:
      Tag: Zope-2_6-branch
	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.15.2.1 ===
--- 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:14:42 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