Dieter Maurer wrote:
>
> Chris Withers writes:
> > Dieter Maurer wrote:
> > >
> > > What you probably need:
> > >
> > > derive a new ObjectManager from Acquisition.Explicit and
> > > the current ObjectManager.
> > >
> > > provide an interface to manage the attributes that should
> > > be acquired implicitly.
> >
> > Well, I had a go at this, but not quite in the way you describe.
> >
> > I subclassed Folder and overrode __getattr_ with:
> This does not work because Python calls "__getattr__" only,
> if it can not find the attribute through "normal" means.
> Due to the implementation of "Acquisition", acquired attributes
> are found by "normal" means bypassing "__getattr__".
Ah, that makes sense :-)
> You may be successful, if you override "__of__".
> It is this method that (usually) builds the acquisition wrapper.
When does it not build the wrapper?
> You can try to build an explicit rather than implicit acquisition
> wrapper.
Yeah, I'll give it a go, once the problems below have been worked out...
> The easiest way, of course, is to derive the class from
> "Acquisition.Explicit" with higher priority (more to the left)
> than from "Acquisition.Implicit".
Hmmm... then maybe use the acquire() method to get hold of names that can be
acquired, in the __getattr__ method?
There is a more fundamental problem here though; If you limit acquisition to a
specified list of names, what do you do about all the stuff Zope normally
silently acquires, like the security context, the REQUEST, etc?
It would be great if you could make it work along the lines of "acquire all the
Zope internal stuff, but beyond that, only acquire if the name is in this list".
But how would we define "all the Zope internal stuff" and how would we implement
the logic?
Hurm... this sounds like a problem of Fultonesque proportions :-S
cheers,
Chris
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )