[mod_python] Authentication and Publisher Handler

Graham Dumpleton grahamd at dscpl.com.au
Sun May 29 07:17:30 EDT 2005

On 29/05/2005, at 8:35 PM, Ales Zemene wrote:

> hi,
> nice example, it works now.
> citation of <grahamd at dscpl.com.au> from Sun, May 29, 2005 at 
> 03:13:56PM +1000, Graham Dumpleton :
>> Include:
>>   PythonDebug On
>> in the Apache configuration.
> that was helping,
> is there a way how to suppress any error messages to browser (or 
> modify them)?
> (if i dont want to confuse user with "Internal Server Error" message)

At the level of mod_python not easily. You might investigate:


Apache 1.3 and 2.0 as appropriate.

Only thing you could do at mod_python level for within your own code is 
use a
try/except block around stuff and catch any exceptions and formulate a 
response page that indicates the error. This can get messy with 
as you need to drop back to coding in the style of basic content 
handler, accepting
req as an input parameter, setting req.status to an appropriate error 
code and
then raising an exception to indicate equivalent of apache.OK.

I'd rather not go into how to do that further as as I said it can get 
Using mod_python.publisher for simple stuff is okay, but when you need 
to go
into that level of customisation it can be a pain. Generally people run 
PythonDebug set to On during development and simply fix any problems. 
When all
is working okay, turn PythonDebug to Off and live with users getting a 
Internal Server response as formatted by Apache. The error is still 
logged to
the Apache log file to assist you later in debugging even when 
is set to Off.

>> Thus, try "form.py/email" instead of just "form/email". Also look in
> hmmm. the html file should not be called  form.html
> and there must really be form.py/email

You should be able to have form.html and form.py with "form.py/email" 
as form
action, but as I mentioned in prior email, MultiViews needs to be off. 
in configuration for that directory where mod_python.publisher being 

   Options -MultiViews


More information about the Mod_python mailing list