[Zope] Re: Post authentication hook question

Dieter Maurer dieter at handshake.de
Sun Feb 20 13:28:07 EST 2005


Please send all Zope related questions to a mailing list
(and not to me privately)!

Cyrille Bonnet wrote at 2005-2-20 11:12 +0100:
> ...
>So, I have been looking into your Post Authentication
>Hook, as well as issue #935 in the Zope Collector
>(same idea, integrated in the Zope Core).
> ...
>* with your code, I don't have a class
>Zope/App/startup.py. Do I have to create it?

This is not a class but a file.

You apply patches (like this) with the "patch" utility.
It usually is installed on Linux; there are version for Windows
around.

For this patch to install, you should be in 

    <yourZopeFolder>/lib/python

> ...
>The line:
>pah=
>getattr(request.PARENTS[0],'post_authentication_hook',None)
>is bit cryptic to me... Sorry :-)

"request.PARENTS" contains the parents of the published object.
It probably is explained in the Zope Book.

"request.PARENTS[0]" is the immediate parent of the published
object (the published object is the one determined by URL traversal).

"getattr" is a Python builtin for computed attribute access.

"pah = getattr(obj, 'post_authentication_hook', None)"
means assign "obj.post_authentication_hook" (maybe acquired)
or "None" to "pah".

Put together: Look whether "request.PARENTS[0]" can acquire
an object 'post_authentication_hook". If so, call it.

Or spelled differently: when you want a "post_authentication_hook"
to be called, you create an object of this name somewhere
in your Zope tree. All URLs that go somewhere into this subtree
have the hook.


>* with the Zope solution, I can't figure out which
>version of Zope includes a fix for issue #395. There
>seems to be no way to link an issue resolution to a
>version number...

I may be wrong -- but I doubt that it found its way into
the Zope core.

The Zope maintainers are quite reluctant to incorporate "features"...

>....
>And then again, how do you define which Python script
>to execute? It seems that one needs to call that
>method: post_traverse(self, f, args), but where, how?
>Do you know of any documentation and/or example?

As I have my own post traversal hook, I never bothered
with its "competitor" :-)

-- 
Dieter


More information about the Zope mailing list