[Zope3-checkins] CVS: Zope3/src/zope/app/publication - zopepublication.py:1.34.2.2

Jim Fulton jim at zope.com
Fri Sep 12 15:16:02 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/publication
In directory cvs.zope.org:/tmp/cvs-serv13470/src/zope/app/publication

Modified Files:
      Tag: parentgeddon-branch
	zopepublication.py 
Log Message:
Can't have the tests passing, can we?

=== Zope3/src/zope/app/publication/zopepublication.py 1.34.2.1 => 1.34.2.2 ===
--- Zope3/src/zope/app/publication/zopepublication.py:1.34.2.1	Mon Sep  8 14:21:44 2003
+++ Zope3/src/zope/app/publication/zopepublication.py	Fri Sep 12 15:15:32 2003
@@ -45,6 +45,8 @@
 # XXX Should this be imported here?
 from transaction import get_transaction
 
+from zope.app.container.contained import ContainedProxy
+
 class Cleanup(object):
     def __init__(self, f):
         self._f = f
@@ -228,7 +230,23 @@
                 request, 'application error-handling')
             view = None
             try:
-                exception = exc_info[1]
+
+                # XXX we need to get a location. The object might not
+                # have one, because it might be a method. If we don't
+                # have a parent attr but to have an im_self or an
+                # __self__, use that:
+
+                loc = object
+                if hasattr(object, '__parent__'):
+                    loc = object
+                else:
+                    loc = removeAllProxies(object)
+                    loc = getattr(loc, 'im_self', loc)
+                    if loc is loc:
+                        loc = getattr(loc, '__self__', loc)
+                    loc = ProxyFactory(loc)
+                
+                exception = ContainedProxy(exc_info[1], loc)
                 name = queryDefaultViewName(exception, request, context=object)
                 if name is not None:
                     view = queryView(exception, name, request, context=object)




More information about the Zope3-Checkins mailing list