[mod_python] How do you specify the order in which mod_python Handlers are called?

Graham Dumpleton grahamd at dscpl.com.au
Sun Apr 10 03:29:23 EDT 2005


On 10/04/2005, at 5:18 PM, Graham Dumpleton wrote:
> One final thing to try with the above is set the .htaccess file to 
> contain
> only:
>
>   PythonHandlerModule mptest
>
> When I know request the ".php" file I see:
>
>   [Sun Apr 10 03:08:47 2005] [notice] mod_python: (Re)importing module 
> 'mptest'
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] 
> </headerparserhandler>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] 
> <headerparserhandler>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] 
> </accesshandler>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] 
> <accesshandler>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] 
> </loghandler>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] 
> <loghandler>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] </cleanup>
>   [Sun Apr 10 03:08:47 2005] [error] [client 128.121.126.33] <cleanup>
>
> I don't quite understand why the header parser handler is executed 
> when the
> "PythonHandlerModule" directive is used, but not when 
> "PythonHeaderParserHandler"
> is used explicitly.


Hmmm, obvious why really. I can't spell. Or at least I used the wrong 
name. The
.htaccess file should have been.

   PythonHeaderParserHandler mptest::headerparserhandler
   PythonAccessHandler mptest::accesshandler
   PythonHandler mptest::handler
   PythonLogHandler mptest::loghandler
   PythonCleanupHandler mptest::cleanuphandler

Then I get:

   [Sun Apr 10 03:25:42 2005] [notice] mod_python: (Re)importing module 
'mptest'
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] 
</headerparserhandler>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] 
<headerparserhandler>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] 
</accesshandler>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] 
<accesshandler>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] 
</loghandler>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] 
<loghandler>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] </cleanup>
   [Sun Apr 10 03:25:42 2005] [error] [client 128.121.126.33] <cleanup>

Whoops. :-)

The reason I didn't pick up that I had the wrong name is linked to the 
bug
with PythonHandlerModule. In short, the check of when to be silent is 
the
wrong way around and it complains when PythonHandlerModule is used and a
handler isn't defined, but not when the explicit directive is used as 
it should.

Graham



More information about the Mod_python mailing list