[mod_python] Accesshandler and normal handler... how they working ?

durumdara durumdara at gmail.com
Tue Nov 14 07:12:22 EST 2006

Hi !

I have an access handler, and a normal python handler in my site.
I use directories, and some of them are need protection. I use my login
method to enable user access.

The access handler is check the needed rights to any object. It get user
data from Session.
When access granted, it finished it's working.
When access denied, it send http403 error, and I catch this with custom
error documents (ssi).

But I want to know something - the background of access handler.

The access handler is existing in same Thread as Handler ?
So I want to know. Is modpy do this:
get url, server info, etc.
build request + other objects
get thread
result = thread.startaccesshandler(req)
if not result:
  result = thread.handler(req)
or it use another technology ?

Can I exchange some data across them ?
In this time I use file based right table(s).
Every file in this table has right property.
I need to load this table in the accesshandler to check grants.
And later, in the menu building I also need to load this table to check
grants (the menus are not accessable by user are hided).
Can I share these infos ? Can I write to the request object, and this
object is hold these infos to get them in normal handler ?

Can I force the access handler to redirect request ?
Example: the user click on menu that preserved for special users. I
don't want to redirect to error pages. Can I redirect to my special
page, or it is useable only in normal handler ?

Thanks for your help:

More information about the Mod_python mailing list