[mod_python] silly question

Daniele Cruciani crxop at tiscali.it
Tue Nov 9 10:47:22 EST 2004


On Tue, Nov 09, 2004 at 08:48:32AM -0600, Gustavo Córdova Avila wrote:
> Daniele Cruciani wrote:
<my message here>
> Naaaaa, actually, you'se wanna define a Location
> inside apache's httpd.conf, like so:
> 
> <Location "/robots.txt">
>    SetHandler python-program
>    PythonHandler robots
>    PythonPath "sys.path + [\"/path/to/your/mod-python/handlers\"]"
> </Location>
> 

Location! ok, and without mod_python I write this:
<Location "/robots.txt">
   SetHandler default-handler
</Location>

this works and don't call mod_python, not really a great advance for
running, but I can just change the content of a text file or upload
it.

thank you (I'll consider to write handler, but I'm busy and this is
just an "hobby" for me)

Daniele.

> I don't think you can use publisher, since there's no mention
> of a ".py" file anywhere in the location, which would foil the
> handler-invoking stuff, but I may be wrong.
> 
> Then, in "robots.py", just do something like:
> 
>    from mod_python import apache
>    def handler(R):
>       R.content_type = "text/plain"
>       R.write("User-agent: *\nDisallow:\n")
>       return apache.OK
> 
> Caveat: I haven't tested it, but I see no reason for it to fail.
> 
> See, it's even a bit easier.  I prefer to write handlers, instead
> of publisher functions, but I suppose it's dependant on each one's
> taste.
> 
> HTH!
> -- 
> Gustavo Córdova Avila <gustavo.cordova at q-voz.com> 
> <mailto:gustavo.cordova at q-voz.com>
> *Tel:* +52 (81) 8130-1919 ext. 127
> Integraciones del Norte, S.A. de C.V.
> Padua #6047, Colonia Satélite Acueducto
> Monterrey, Nuevo León, México.




More information about the Mod_python mailing list