[mod_python] mod_python newbie help

Jorey Bump list at joreybump.com
Mon Oct 3 14:18:24 EDT 2005


El TuZa wrote:
> Hi list, my question is about handling "compilation" errors (using
> publisher). for example if someone calls a function with no params it
> returns the error with all the python specifications about it, but i
> just want to inform that person my own message or just call an error
> function. Can this be done? thanks a lot

You can suppress such errors by setting:

  PythonDebug off

and/or use conventional Python exceptions to handle errors:

try:
     a = req.form['myvar']
except KeyError, key:
     return '<h1>No form variable by that name: %s</h1>' % (key,)


More information about the Mod_python mailing list