mod_python, multiple calls to PythonAuthenHandler

Steve Holden steve at holdenweb.com
Mon Nov 8 08:18:45 EST 2004


Rune Hansen wrote:

> I've posted this question on the mod_python mailing list but didn't get 
> much response, so I thought I'd post it here.
> 
> (My first attempt connected to an unrelated thread..sorry.
> Note-to-self:-must-get-more-coffee-before-posting-)
> 
> It seems to me that for each path element in a URI a mod_python handler
> will be invoked. This applies to PythonAuthenHandler,
> PythonHeaderParserHandler and so on.
> 
> Since I'm making a database request in my PythonAuthenHandler, this 
> quickly becomes a problem.
> 
> Example:
> http://lucene.moonspawn.scanmine.com/ =>
> 	AuthenHandler::authenhandler called: 1
> 	index got called once
> 
> http://lucene.moonspawn.scanmine.com/SearchHandler.py/search =>
> 	AuthenHandler::authenhandler called: 1
> 	AuthenHandler::authenhandler called: 2
> 	/search got called once
> 
> http://lucene.moonspawn.scanmine.com/search.html => (using mod_rewrite)
> 	AuthenHandler::authenhandler called: 1
> 	AuthenHandler::authenhandler called: 2
> 	AuthenHandler::authenhandler called: 3
> 	/search got called once
> 
> I get the same behavior on three separate installations
> 
> So, either I've got a miss-configuration which results in multiple calls 
> to handlers or.., this is expected behavior, and there is a technique to 
> avoid this or..., this is expected and, for reasons that escapes me, 
> desired behavior.
> 
> I'd greatly appreciate any help and suggestion
> 
> regards
> 
> /rune

Well, the thing that's missing here is the code of your AuthenHandler 
(or some detail about which standard component you think is being used). 
Is it possible you are making internal redirects, for example?

The information about using mod_rewrite does imply you are spending time 
on authentication rather more frequently than you strictly need to, but 
it's difficult to figure out from just the information given.

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list