[Zope-Checkins]
SVN: Zope/branches/philikon-aq/lib/python/Products/Five/b
Commit first version of AQBBB
Hanno Schlichting
plone at hannosch.info
Tue Aug 28 16:13:03 EDT 2007
Log message for revision 79325:
Commit first version of AQBBB
Changed:
U Zope/branches/philikon-aq/lib/python/Products/Five/bbb.py
U Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py
-=-
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/bbb.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/bbb.py 2007-08-28 19:56:54 UTC (rev 79324)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/bbb.py 2007-08-28 20:13:03 UTC (rev 79325)
@@ -19,10 +19,32 @@
from zope.component.interfaces import ComponentLookupError
from zope.app.publisher.browser import getDefaultViewName
-import zExceptions
-import Products.Five.security
-from Products.Five import fivemethod
+import Acquisition
+
+class AquisitionBBB(object):
+ """Emulate a class implementing Acquisition.interfaces.IAcquirer and
+ IAcquisitionWrapper.
+ """
+
+ def __of__(self, context):
+ # Technically this isn't in line with the way Acquisition's
+ # __of__ works. With Acquisition, you get a wrapper around
+ # the original object and only that wrapper's parent is the
+ # new context.
+ return self
+
+ aq_self = aq_inner = aq_base = property(lambda self: self)
+ aq_chain = property(Acquisition.aq_chain)
+ aq_parent = property(Acquisition.aq_parent)
+
+ def aq_acquire(self, *args, **kw):
+ return Acquisition.aq_acquire(self, *args, **kw)
+
+ def aq_inContextOf(self, *args, **kw):
+ return Acquisition.aq_inContextOf(self, *args, **kw)
+
+
class IBrowserDefault(Interface):
"""Provide a hook for deciding about the default view for an object"""
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py 2007-08-28 19:56:54 UTC (rev 79324)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/__init__.py 2007-08-28 20:13:03 UTC (rev 79325)
@@ -18,23 +18,16 @@
import Acquisition
import zope.publisher.browser
-class BrowserView(zope.publisher.browser.BrowserView):
+from Products.Five.bbb import AquisitionBBB
- # BBB for code that expects BrowserView to still inherit from
- # Acquisition.Explicit.
+class BrowserView(zope.publisher.browser.BrowserView, AquisitionBBB):
+
# Use an explicit __init__ to work around problems with magically inserted
# super classes when using BrowserView as a base for viewlets.
def __init__(self, context, request):
zope.publisher.browser.BrowserView.__init__(self, context, request)
- def __of__(self, context):
- # Technically this isn't in line with the way Acquisition's
- # __of__ works. With Acquisition, you get a wrapper around
- # the original object and only that wrapper's parent is the
- # new context.
- return self
-
# 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.
@@ -46,14 +39,3 @@
self._parent = parent
aq_parent = __parent__ = property(__getParent, __setParent)
-
- # We provide the aq_* properties here for BBB
- aq_self = aq_inner = aq_base = property(lambda self: self)
- aq_chain = property(Acquisition.aq_chain)
-
- def aq_acquire(self, *args, **kw):
- return Acquisition.aq_acquire(self, *args, **kw)
-
- def aq_inContextOf(self, *args, **kw):
- return Acquisition.aq_inContextOf(self, *args, **kw)
-
More information about the Zope-Checkins
mailing list