[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publication/zopepublication.py Two error handling corrections:

Shane Hathaway shane at zope.com
Tue Nov 16 16:46:32 EST 2004


Log message for revision 28465:
  Two error handling corrections:
  
  1. If we can't get the path of an object in order to annotate the 
  transaction, we have to swallow the TypeError and not record any path.  
  However, a better solution would be for the path discovery code to 
  raise something more meaningful than TypeError.
  
  2. When rendering an exception view, call mapply() directly to 
  avoid passing positional arguments.  Otherwise, the system breaks 
  when trying to report errors that occur in XML-RPC methods that
  accept arguments. 
  

Changed:
  U   Zope3/trunk/src/zope/app/publication/zopepublication.py

-=-
Modified: Zope3/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/zopepublication.py	2004-11-16 21:38:04 UTC (rev 28464)
+++ Zope3/trunk/src/zope/app/publication/zopepublication.py	2004-11-16 21:46:32 UTC (rev 28465)
@@ -189,7 +189,7 @@
             # dead end.
             try:
                 path = locatable.getPath()
-            except AttributeError:
+            except (AttributeError, TypeError):
                 pass
         if path is not None:
             txn.setExtendedInfo('location', path)
@@ -305,7 +305,12 @@
 
             if view is not None:
                 try:
-                    response.setBody(self.callObject(request, view))
+                    # We use mapply instead of self.callObject here
+                    # because we don't want to pass positional
+                    # arguments.  The positional arguments were meant
+                    # for the published object, not an exception view.
+                    body = mapply(view, (), request)
+                    response.setBody(body)
                     get_transaction().commit()
                     if (ISystemErrorView.providedBy(view)
                         and view.isSystemError()):



More information about the Zope3-Checkins mailing list