[Zope-CMF] Re: Implicit and Acquirer
Tres Seaver
tseaver at palladion.com
Sat Mar 11 14:42:22 EST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dieter Maurer wrote:
> George Lee wrote at 2006-3-11 00:41 -0500:
>
>>...
>>What is the difference between Implicit and Acquirer? Between Explicit
>>and Acquirer?
>
>
> An acquirer is an object with two components "aq_self" and "aq_parent".
> If asked for an attribute, any acquirer passes the request on
> to "aq_self" and returns the result if "aq_self" can deliver
> the attribute.
>
> The difference between an ImplicitAcquirer and an ExplicitAcquirer
> comes only into play when "aq_self" cannot deliver the asked
> for attribute. In this case, an ImplicitAcquirer automatically
> passed the request on "aq_parent" while an ExplicitAcquirer fails
> (with an AttributeError).
>
>
>>Including, what methods do Implicit and Explicit *add* or *override*?
>
>
> Both have the same methods (and attribute).
>
>
>>For instance, does Explicit add an aq_acquire method?
>
>
> No. But "aq_acquire" is more important for an "ExplicitAcquirer"
> than for an "ImplicitAcquirer":
>
> "aq_acquire" supports precise control over the lookup
> behaviour of all kinds of acquirers.
>
> With an "ExplicitAcquirer", you (usually) must use "aq_acquire"
> to look the attribute up in "aq_parent"; an "ImplicitAcquirer"
> would do this automatically (if necessary).
>
>
>>What else?
>
>
> Nothing.
>
>
>>I tried sifting through the C code and the epydoc files but still
>>couldn't make sense of it all -- it seems that Implicit and Acquirer
>>are really the same, for instance. Answers or references would be very
>>appreciated, thanks.
>
>
> Apparently, you have a reason to use the strange "Implicit and Acquirer"...
>
> In fact, there are two kinds of "Acquirers": "ImplicitAcquirer"
> and "ExplicitAcquirer". There is nothing like "Implicit and Acquirer".
Perhaps the distinction is that 'Impleict' and 'Explicit' are the names
of mixin classes, whose '__of__' method returns an 'ImplicitAcquirer' /
'ExplicitAcquirer' wrapper (respectively). The wrapper is what does the
actual majyk which Dieter describes.
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEEyge+gerLs4ltQ4RAqvXAKCKJh+L08QI6aGycl1QvsLDwedu0QCfSeWO
RiGynPjwmS98w9I2C6mfZMQ=
=P4H+
-----END PGP SIGNATURE-----
More information about the Zope-CMF
mailing list