[Zope3-dev] Form framework, adapters and pau

Jim Fulton jim at zope.com
Fri Apr 15 10:20:28 EDT 2005


Dominik Huber wrote:
> Jim Fulton wrote:
> 
>> Dominik Huber wrote:
>>
>>> Jim Fulton wrote:
>>>
>>>> OK, here's an alternate proposal:
>>>>
>>>>   If the permission attribute is used in the adapter directive and the
>>>>   permission is not zope.Public, then:
>>>>
>>>>     If the adapter doesn't provide ILocation, we location proxy it and
>>>>     set the parent.
>>>>
>>>>     If the adapter does provide ILocation and it's __parent__ is None,
>>>>     we set the __parent__.
>>>>
>>>>   This will be accomplished with a custom factory.
>>>>
>>>> Does this make you happy? :)
>>>
>>>
>>>
>>>
>>> Yes, cool  ;)
>>> Can I help anything or are you going to implement that code
>>
>>
>>
>> I don't think I'll have time to do this soon.  Will this be for
>> 3.1 or 3.2?  Is it a feature or a bug fix? :)
> 
> 
> I fixed that issue within the branch 
> 'Zope3/branches/dominik-locatableadapters'
> Jim, could you take a look at that please. Thank you very much in advance!

This looks great, however, it points out a serious problem with
implicitly proxying adapters.  You proxy adapters that don't
require a permission. This led to the breakage you encountered with
key references.

We should *only* add the location if the adapter requires a permission other
than zope public.  Key rereferences don't require a permission and should not
be location proxied. Doing so makes them unpicklable.

We're going to need to fix the trusted adapter factory to do this correctly.
I suggest we create a new kind of trusted adapter factory, perhaps
"LocatingTrustedAdapter" factory that adds the location. This should
only be used when the adapter directive specified a permission other
than zope.Public. Otherwise, the original trusted adapter factory should
be used.

Of course, you should revert the change to key references.

I'd be happy to look at this again when you're done.

Thanks.

Jim

P.S. Please make sure source lines are 79 characters or less in lengnth. :)


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list