Descriptors and Properties lose acquisition wrappers (was Re: Browser views: inherit from object or BrowserView from Five/Plone)

Ross Patterson me at rpatterson.net
Sun Apr 29 18:31:15 UTC 2007


Daniel Nouri <daniel.nouri at gmail.com>
writes:

> Martin Aspeli wrote:
>
>> Unfortunately, acquisition doesn't work properly inside Python property
>> __get__ accessors. I've seen this pattern before, but I've seen people have
>> various problems with it (that I can't remember the details of right now).
>
> Hmm, I've been using @property now for quite a long time for handling
> context without any problems.  It would be good to have a minimal failing
> example.
>
> I know that formlib actions, which are applied via a decorator, have
> problems with acquisition.  But then, they do much more than @property.

Here's a doctest showing what I think Martin was talking about:

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: README.txt
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20070429/79fa7bf1/attachment.txt>
-------------- next part --------------

Those last two "True"s come out "False" if you actually run this test.

It's a problem in all descriptors as far as I can tell.  I'd be very
interested in any work arounds for this as I run into it all the time.

Also, is there someplace this test might be included?  Or is this
considered not to be a bug?

Also attached is a tarball of a minimal product providing this doctest.

Ross

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aqdescriptors.tar.bz2
Type: application/octet-stream
Size: 1010 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20070429/79fa7bf1/attachment.obj>


More information about the Product-Developers mailing list