Log message for revision 78463:
  Moved special __parent__ behaviour up to the browserview class, so all 
classes inheriting from it, gain this special behavior.
  

Changed:
  U   Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py
  U   Zope/branches/philikon-aq/lib/python/Products/Five/browser/adding.py

-=-
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py      
2007-07-29 15:22:17 UTC (rev 78462)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py      
2007-07-29 15:26:37 UTC (rev 78463)
@@ -17,8 +17,10 @@
 """
 
 import zope.publisher.browser
-import Acquisition
 
+from Acquisition import aq_chain
+from Acquisition import aq_inner
+
 class BrowserView(zope.publisher.browser.BrowserView):
 
     # BBB for code that expects BrowserView to still inherit from
@@ -27,6 +29,18 @@
     def __of__(self, context):
         return self
 
+    # XXX Classes which are still based on Acquisition and access
+    # self.context in a method need to call aq_inner on it, or get a funky
+    # aq_chain. We do this here for BBB friendly purposes.
+
+    def __getParent(self):
+        return getattr(self, '_parent', aq_inner(self.context))
+
+    def __setParent(self, parent):
+        self._parent = parent
+
+    __parent__ = property(__getParent, __setParent)
+
     # We provide the aq_* properties here for BBB
 
     @property
@@ -41,4 +55,4 @@
 
     @property
     def aq_chain(self):
-        return Acquisition.aq_chain(self)
+        return aq_chain(self)

Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/adding.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/adding.py        
2007-07-29 15:22:17 UTC (rev 78462)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/adding.py        
2007-07-29 15:26:37 UTC (rev 78463)
@@ -35,7 +35,6 @@
 from zope.app.container.constraints import checkFactory, checkObject
 from zope.app.publisher.browser.menu import getMenu
 
-from Acquisition import aq_inner
 from zExceptions import BadRequest
 from OFS.SimpleItem import SimpleItem
 
@@ -206,16 +205,6 @@
 
     menu_id = "add_content"
 
-    def __getParent(self):
-        # This class is based on Acquisition and accesses self.context
-        # We need to call aq_inner on it, or we get a funky aq_chain
-        return getattr(self, '_parent', aq_inner(self.context))
-
-    def __setParent(self, parent):
-        self._parent = parent
-
-    __parent__ = property(__getParent, __setParent)
-
 class ObjectManagerNameChooser:
     """A name chooser for a Zope object manager.
     """

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to