[Zope-Checkins] CVS: Zope/lib/python/OFS - ObjectManager.py:1.141.6.7
Jim Fulton
jim@zope.com
Thu, 25 Oct 2001 12:35:16 -0400
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv28851/lib/python/OFS
Modified Files:
Tag: ComponentArchitecture-branch
ObjectManager.py
Log Message:
Various changes (in progress) to reflect tutorial.
Checking in to sync with Shane.
=== Zope/lib/python/OFS/ObjectManager.py 1.141.6.6 => 1.141.6.7 ===
_checkId = checkValidId
- def _setOb(self, id, object): setattr(self, id, object)
+ def _setOb(self, id, object):
+ # XXX Ugh. Having this be a mix-in
+ # spreads the hackosity.
+
+ # OK, this hack makes sure that we get wrapped objects back
+ # on getattrs. This is only needed if the object does't
+ # wrap itself and if the object manager provides access to
+ # items via getattr. Eventually, we must stop this madness.
+ if not hasattr(object, '__of__'):
+ object=WrapperWrapper(object)
+
+ setattr(self, id, object)
def _delOb(self, id): delattr(self, id)
def _getOb(self, id, default=_marker):
# FIXME: This is really slow ;-)
@@ -886,3 +897,16 @@
Globals.default__class_init__(ObjectManager)
+import ExtensionClass
+class WrapperWrapper(ExtensionClass.Base):
+
+ def __init__(self, o): self.__o=o
+
+ import Acquisition
+ def __of__(self, p,
+ aq_base=Acquisition.aq_base,
+ wrap=Acquisition.ExplicitAcquisitionWrapper):
+ return wrap(aq_base(self.__o), p)
+ del Acquisition
+
+del ExtensionClass