[mod_python] transhandler setup?

IR labs labs at ixopusada.com
Thu Sep 1 22:32:49 EDT 2005

On 2-sep-05, at 03:39, Graham Dumpleton wrote:
> For an internal redirect, you probably want:
>   req.internal_redirect(req.uri+'/index.html')
> This will not send a response back to the browser and it will managed 
> internal
> to Apache. The downside of this approach is that the same page is 
> returned
> under two different URLs, as index.html can also be accessed directly. 
> This
> confuses the results of search engines.

How does that confuses the results of search engines? Is it not 
standard web server behavior to go look for an index.html, index.py, 
index.php or alike when a url like www.myserver.com/some/directory/ is 
requested? (I mean: huh? Does it also confuses search engines when 
there are static directories and index.html files ???)

>> Then I thought that maybe transhandler could help me in the end, but I
>> got stuck with that one rather soon.
>> 2. Using transhandler to set the filename and have it decide what
>> apache should be doing.
>> <IfModule mod_python.c>
>>      PythonPath "sys.path + ['/var/www/python/']"
>>      PythonTransHandler translate
> Try adding here in addition to the above:
>   AddHandler mod_python .py
>   PythonHandler main
> Ie., rather than trying to use req.add_handler(). What happens then?

Exactly the same. I.e the code of main.py is written to the browser as 
text/plain. Strange...

Dirk van Oosterbosch
dirk at ixopusada.com

More information about the Mod_python mailing list