[Zope-Checkins] CVS: Zope/lib/python/OFS - ObjectManager.py:1.147.18.1

Casey Duncan c.duncan@nlada.org
Mon, 11 Mar 2002 17:38:32 -0500


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

Modified Files:
      Tag: casey-death_to_index_html-branch
	ObjectManager.py 
Log Message:
Initial implementation of a BrowserDefault class for use in dynamically 
specifying browser_default in ObjectManagers


=== Zope/lib/python/OFS/ObjectManager.py 1.147 => 1.147.18.1 ===
             )
 
+class BrowserDefault(Acquisition.Implicit, Persistent):
+    """Callable default browser object. This is made as a class so that
+       folderish objs not overriding browser_default can simply not define it.
+       We also define this class as replaceable so that TTW scripts can
+       override it
+    """
+    __replaceable__ = REPLACEABLE # Allow this to be overridden
+
+    def __init__(self, default_name):
+        self._default_path = (default_name,)
+
+    def __call__(self, request):
+        """Return the proper default method name to be published"""
+        return self.aq_parent, self._default_path
 
 class BeforeDeleteException( Exception ): pass # raise to veto deletion
 class BreakoutException ( Exception ): pass  # raised to break out of loops