[Zope3-checkins] CVS: Zope3/src/zope/app - dependable.py:1.6

Jim Fulton jim at zope.com
Sun Sep 21 13:30:12 EDT 2003


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

Modified Files:
	dependable.py 
Log Message:
Modified some code that tried to get a parent path for an object and
that fell back to an empty string if the object didn't have a complete
path. Unfortunately, the code was brittle. Changed to more carefully
fall back if a parent could not be gotten.

Later, we'll refactor the dependency framework so that it doesn't use
paths and this logic will go away.


=== Zope3/src/zope/app/dependable.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/dependable.py:1.5	Thu Jun 12 15:28:08 2003
+++ Zope3/src/zope/app/dependable.py	Sun Sep 21 13:30:12 2003
@@ -36,11 +36,15 @@
     def __init__(self, context):
         self.context = context
         try:
-            pp = getPath(getParent(self.context))
+            parent = getParent(self.context)
+        except TypeError:
+            parent = None
+        if parent is not None:
+            pp = getPath(parent)
             if not pp.endswith("/"):
                 pp += "/"
             self.pp = pp # parentpath
-        except TypeError:
+        else:
             self.pp = ""
         self.pplen = len(self.pp)
 




More information about the Zope3-Checkins mailing list