[Zope-Checkins] CVS: Zope/lib/python/Zope - __init__.py:1.23.20.1

Shane Hathaway shane@digicool.com
Wed, 26 Sep 2001 17:59:47 -0400


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

Modified Files:
      Tag: ComponentArchitecture-branch
	__init__.py 
Log Message:
Used getPhysicalPathOf() function


=== Zope/lib/python/Zope/__init__.py 1.23 => 1.23.20.1 ===
 
 
+from OFS.Traversable import getPhysicalPathOf
+
+
 class TransactionsManager:
     def begin(self,
               # Optimize global var lookups:
@@ -251,35 +254,36 @@
                        LOG=LOG, WARNING=WARNING,
                        ):
         request_get = request.get
-        if hasattr(object, 'getPhysicalPath'):
-            path = join(object.getPhysicalPath(), '/')
-        else:
-            # Try hard to get the physical path of the object,
-            # but there are many circumstances where that's not possible.
-            to_append = ()
+        path = join(getPhysicalPathOf(object), '/')
+##        if hasattr(object, 'getPhysicalPath'):
+##            path = join(object.getPhysicalPath(), '/')
+##        else:
+##            # Try hard to get the physical path of the object,
+##            # but there are many circumstances where that's not possible.
+##            to_append = ()
             
-            if hasattr(object, 'im_self') and hasattr(object, '__name__'):
-                # object is a Python method.
-                to_append = (object.__name__,)
-                object = object.im_self
+##            if hasattr(object, 'im_self') and hasattr(object, '__name__'):
+##                # object is a Python method.
+##                to_append = (object.__name__,)
+##                object = object.im_self
                 
-            while object is not None and \
-                  not hasattr(object, 'getPhysicalPath'):
-                if not hasattr(object, '__name__'):
-                    object = None
-                    break
-                to_append = (object.__name__,) + to_append
-                object = getattr(object, 'aq_inner', object)
-                object = getattr(object, 'aq_parent', None)
-
-            if object is not None:
-                path = join(object.getPhysicalPath() + to_append, '/')
-            else:
-                # As Jim would say, "Waaaaaaaa!"
-                # This may cause problems with virtual hosts
-                # since the physical path is different from the path
-                # used to retrieve the object.
-                path = request_get('PATH_INFO')
+##            while object is not None and \
+##                  not hasattr(object, 'getPhysicalPath'):
+##                if not hasattr(object, '__name__'):
+##                    object = None
+##                    break
+##                to_append = (object.__name__,) + to_append
+##                object = getattr(object, 'aq_inner', object)
+##                object = getattr(object, 'aq_parent', None)
+
+##            if object is not None:
+##                path = join(object.getPhysicalPath() + to_append, '/')
+##            else:
+##                # As Jim would say, "Waaaaaaaa!"
+##                # This may cause problems with virtual hosts
+##                # since the physical path is different from the path
+##                # used to retrieve the object.
+##                path = request_get('PATH_INFO')
 
         T=get_transaction()
         T.note(path)