[mod_python] Re: mod_python.publisher and Cheetah

Stephane Bortzmeyer bortzmeyer at nic.fr
Tue Mar 15 06:28:53 EST 2005


On Mon, Mar 14, 2005 at 06:25:50PM -0500,
 Graham Dumpleton <grahamd at dscpl.com.au> wrote 
 a message of 200 lines which said:

> Here is a better version of a handler which allows use of Cheetah
> templates with mod_python.

It seems to work fine. Many thanks.

>   target = req.filename + ".py"
> 
>   if not os.path.exists(target):
>     return apache.DECLINED

I changed it (personal preference and I have only Python content) to:

  if req.filename[:-3] != ".py":
     target = req.filename + ".py"
  else:
     target = req.filename

  if not os.path.exists(target):
    raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND



More information about the Mod_python mailing list