[Zope] __getattr__ and getPhysicalRoot()
Stefan Bund
l-zope.z.xalan at xoxy.net
Fri Apr 30 02:12:38 EDT 2004
Dieter Maurer <dieter at handshake.de> writes:
> You may have a look at my "Reference" product and
> see how I tackle a similar problem:
>
> <http://www.dieter.handshake.de/pyprojects/zope>
Thanks. I already did that... you override __of__ instead of
__getattr__. But that will not work in my case. Some more details, of
what I wanted to accomplish:
I wanted to implement something which behaves like a
TransparendFolder, extending acquisition to another object not on the
direct acquisition path. But instead of placing a folder with
transparently to be acquired objects into a folder, I wanted to place
a link or reference to some other folder into the folder which would
transparently acquire the objects of that folder into the current
folder. This would enable me to do something like the 'multiple
inheritance' of classes using acquisition in such a way, that for any
folder I could explicitly list any 'base' folders to be acquired.
To explain further: I have already implemented a system to give every
page on my website an abstract interface. But at the moment, this
interface has to be reimplemented fully for each and every page. Often
page interfaces multiply inherit other interfaces (every page inherits
the main menu interface, others might inherit the news interface and
so on). It would be very nice instead of reimplementing the interfaces
for every folder or using some complicated acquisition path magic just
to import the implementation from somewhere else into the folder using
above link pattern.
I am now pretty convinced, that this is impossible using just the
TransparentFolderPatch, as this checks the attributes of the
transparent object at __getattr__ time and there is no acquisition
possible at that time. So I believe, I'll have to go the other route,
and implement a special folder type, which does what your Reference
Product does: add all the imported implementation folders to the
acquisition path in __of__.
I hope, my intent is clear now. If anyone has any idea, how to
implement my original link scheme, I'd appreciate a pointer ...
Stefan.
--
-- *DON'T* TRY TO REACH ME DIRECTLY AT ABOVE EMAIL ADDRESS. Any reply
-- received off-list at that address will be *silently* and
-- *unconditionally* dropped. You can attribute this inconvenience to
-- the proliferation of spammers on the Internet. I hope, you can
-- understand my position and accept my counter measures.
More information about the Zope
mailing list