[Zope-CVS] CVS: Products/DBTab - MountedObject.py:1.8

Shane Hathaway shane@zope.com
Fri, 13 Jun 2003 16:51:43 -0400


Update of /cvs-repository/Products/DBTab
In directory cvs.zope.org:/tmp/cvs-serv26296

Modified Files:
	MountedObject.py 
Log Message:
Fixed the mount point status reporting.

If an object was mounted, then the mounted object got deleted and another
object was put in its place, the status screen incorrectly showed the
object as mounted.


=== Products/DBTab/MountedObject.py 1.7 => 1.8 ===
--- Products/DBTab/MountedObject.py:1.7	Wed Jun 11 17:53:58 2003
+++ Products/DBTab/MountedObject.py	Fri Jun 13 16:51:43 2003
@@ -203,10 +203,21 @@
 
 
 def getMountPoint(ob):
+    """Gets the mount point for a mounted object.
+
+    Returns None if the object is not a mounted object.
+    """
     container = aq_parent(aq_inner(ob))
     mps = getattr(container, '_mount_points', None)
     if mps:
-        return mps.get(ob.getId())
+        mp = mps.get(ob.getId())
+        if mp is not None and mp._p_jar is ob._p_jar:
+            # Since the mount point and the mounted object are from
+            # the same connection, the mount point must have been
+            # replaced and the object is not mounted.
+            return None
+        # else the object is mounted.
+        return mp
     return None