Excuse me late response I was busy that weekend...

Jim Fulton wrote:

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!


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.

May be I do not understand the problem correctly:

IMO the permission declaration within the adapter directive has nothing to do
with the permission declaration wihtin the class directive that mus be used if
trusted adapters are invoked.

Example KeyReference Adapter:


<class class=".persistent.KeyReferenceToPersistent">
<require permission="zope.Public" interface=".interfaces.IKeyReference" />

So, during the registration of an trusted adapter factory (<adapter...) I can't do any prediction about the
permission declaration of the possible adapter instances (<class ...). Therefore we can't switch the
adapter factories within the adapter directive processing..

All the same I implemented your sugestion. The following question appears:
- How should we handle NullAdapters correctly?

IMO this solution is pretty implicit and I do not like it at all.
We should find a way to check the permission of the adapter instances inside a single trusted adapter factory:

class IntelligentTrustedAdapterFactory(TrustedAdapterFactoryMixin):

   def _customize(self, adapter, context):
       p = ProxyFactory(adapter)
       checker = getChecker(p)
       if checker is CheckerPublic:
           return adapter
          return assertLocation(adapter, context)

- performance
- in the key refernce example it would be an dedicated checker. how could I guess if such an checker is Public?

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



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


Thank you for the comments!

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to