Log message for revision 113379:
  Handle Unauthorized exceptions in xmlrpc correctly - backport from trunk
  

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/ZPublisher/xmlrpc.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst  2010-06-12 10:56:01 UTC (rev 113378)
+++ Zope/branches/2.12/doc/CHANGES.rst  2010-06-12 10:58:43 UTC (rev 113379)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++++++++++
 
+- Handle Unauthorized exceptions in xmlrpc correctly.
+
 - Five's processInputs() would stomp on :list or :tuple values that contained
   ints or other non-strings, would clear out :records entirely, and would not
   do anything for :record fields.

Modified: Zope/branches/2.12/src/ZPublisher/xmlrpc.py
===================================================================
--- Zope/branches/2.12/src/ZPublisher/xmlrpc.py 2010-06-12 10:56:01 UTC (rev 
113378)
+++ Zope/branches/2.12/src/ZPublisher/xmlrpc.py 2010-06-12 10:58:43 UTC (rev 
113379)
@@ -148,16 +148,15 @@
                   absuri_match=None, tag_search=None):
         # Fetch our exception info. t is type, v is value and tb is the
         # traceback object.
-        if type(info) is type(()) and len(info)==3: t,v,tb = info
-        else: t,v,tb = sys.exc_info()
+        if isinstance(info, tuple) and len(info) == 3:
+            t, v, tb = info
+        else:
+            t, v, tb = sys.exc_info()
 
         # 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 issubclass(t, Unauthorized):
             return self._real.exception(fatal=fatal, info=info)
 
         # Create an appropriate Fault object. Containing error information
@@ -175,7 +174,6 @@
                 value = '\n' + ''.join(format_exception(t, vstr, tb))
             else:
                 value = '%s - %s' % (t, vstr)
-                
             if isinstance(v, Fault):
                 f=v
             elif isinstance(v, Exception):

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to