[mod_python] TransHandler help?

Oliver Cope oliver at redgecko.org
Mon Jan 7 22:08:09 EST 2002


On Mon, Jan 07, 2002 at 07:32:10PM +0000, Alan Kennedy wrote:
>
> I'm trying to get a PythonTransHandler working.
> 
<snip>

> *without* sending a redirect back to the client. Or a more sophisticated
> example, how could I turn a request for
> 
> /admin/abc1234/update/item4567
> 
> into a request for
> 
> /admin/doit.html?sessionID=abc1234&command=update&what=item4567
> 
I too have spent some time trying to configure a PythonTransHandler, but
couldn't get it to work :o(
		
I've had more luck using mod_rewrite for this kind of thing:

RewriteEngine On
RewriteRule /admin/(.*)/(.*)/(.*) /admin/doit.html?sessionID=$1&command=$2&what=$3 [PT]

This will rewrite requests without sending redirects back to the client.
You can remove the '[PT]' if you don't need to further process the
rewritten URL (e.g. through a PythonHandler).

Obviously regular expressions are not as flexible as a Python
handler can be, so this will only work for simple translations.  Also
you'll need to have Apache compiled with mod_rewrite, I'm not sure if
this is the default.

Regards,

Olly.




More information about the Mod_python mailing list