[mod_python] new to mod_python, with a question.

Jeff Davis list-mod_python at empires.org
Tue Jul 16 13:38:19 EST 2002


Is is possible that you're using the publisher handler? The publisher handler 
basically does a req.write() on whatever is returned by your function. So, it 
looks like it's printing the actual text of apache.OK after all of your 
req.write()s. Look in your apache config for possible use of 
mod_python.publisher, or perhaps something else that might print the return 
of your function.

Regards,
	Jeff

On Monday 15 July 2002 03:46 pm, Bill Anderson wrote:
> OK, so here is what I am doing. I am using PageTemplates (from zope) and
> mod_python. or at least, I am trying to. :)
>
>
> if I do _NOT_ use the request object (i.e. I return a fully formed html
> string/document), it works fine. but of course, that means no use of
> mod-python's request objects functions such as cookie/header
> construction, usage, etc.
>
> To wit:
> def sayit(req,x=12):
> 	if not x:
> 		return "I need x"
> 	if not master:
> 		return "I need a master object"
> 	pt=PageTemplate()
> 	filestring =
> "".join(open("/home/ucntcme/public_html/pythonapps/test.pt").readlines())
> 	pt.write(filestring)
> 	myx=int(x)
>         req.content_type="text/html"
>         req.send_http_headers()
> 	req.write( pt(x=myx,master=master) )
> 	return apache.OK
>
> returns my rendered template, but at the bottom has:
>
> HTTP/1.1 200 OK Date: Mon, 15 Jul 2002 22:44:27 GMT Server:
> Apache/1.3.22 (Unix) (Red-Hat/Linux) mod_python/2.7.8 Python/2.2.1
> mod_ssl/2.8.5 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6 mod_perl/1.26
> Connection: close Transfer-Encoding: chunked Content-Type: text/html;
> charset=iso-8859-1
> OK
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
>
>
>
> Debug is on, and there are no mesages in the error_log.
>
> Now, if I just return the content using return (content), it works fine.
>
> Why is this/what am I doing wrong here?
>
> Cheers, Bill
>
>
>
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python




More information about the Mod_python mailing list