Graham Dumpleton
grahamd at dscpl.com.au
Thu Jan 27 04:29:56 EST 2005
On 27/01/2005, at 5:42 PM, Brandon Masterson wrote: > EXAMPLE 2 > ----------------------------------------------------------------------- > --------------------------------------------------------------------- > Okay, here's a simple script that I believe demos things are working: > > from mod_python import util > from mod_python import apache > import os > > def page(req): > req.content_type = 'text/html' > req.write('<html><head><title>Available Projects</title></head>') > req.write('<body><h1>Available Projects</h1><ul>') > req.write('Processing ') > req.write('</ul></body><html>') > > PRODUCES ON THE BROWSER: > > Available Projects > > Processing > > HTTP/1.1 500 Internal Server Error Date: Thu, 27 Jan 2005 04:37:26 GMT > Server: Apache/1.3.33 (Debian GNU/Linux) mod_python/2.7.10 > Python/2.3.4 PHP/4.3.8-5 mod_ssl/2.8.22 OpenSSL/0.9.7d Connection: > close Transfer-Encoding: chunked Content-Type: text/html; > charset=iso-8859-1 252 > Internal Server Error > The server encountered an internal error or misconfiguration and was > unable to complete your request. > > Please contact the server administrator, webmaster at Knoppix and inform > them of the time the error occurred, and anything you might have done > that may have caused the error. > > More information about this error may be available in the server error > log. > > Apache/1.3.33 Server at 192.168.0.12 Port 80 > 0 > > ERROR LOG: > [Wed Jan 26 23:37:26 2005] [notice] mod_python: (Re)importing h from > ['/var/www/pythontest'] Okay, understand now. I didn't notice that you were using mod_python 2.7.10 before. What you have found is a bug in 2.7.10. Namely, that you will get a 500 server error if you do not return anything, or return an empty string from the method. Add: return " " at the end of the method. Ie., string containing a single character and it looks like it will work. Weird. The code works fine on 3.X mod_python. Ie., handles no return value. Graham
|