[mod_python] An odd use of the publisher

Colin Fox cfox at cfconsulting.ca
Sun Mar 14 13:35:00 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gregory (Grisha) Trubetskoy wrote:
| On Sat, 13 Mar 2004, Colin Fox wrote:
|
|
|>-----BEGIN PGP SIGNED MESSAGE-----
|>Hash: SHA1
|>
|>Ron Alford wrote:
|>| Colin Fox wrote:
|>|
|>|> To get around the return issue, I'm finishing off my handler with this:
|>|>
|>|> ~    raise apache.SERVER_RETURN, apache.OK
|>|
|>|
|>| How does a straight 'return' with no arguments work? I thought I was
|>| using that at one point.
|>
|>It doesn't work
|
|
| Can you elaborate on the "doesn't work"? It's supposed to, at least on
| version 3.1.x and may be even 3.0.x
|
| Grisha

Perhaps I am just totally missing something, but if I have a
mod_python.publisher handler called 'blah.py', with a function in it
called 'index':

def index(req):
~    req.write("hello, world!")
~    req.content_type("text/plain")
~    return

This is what I get:

hello, world!<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
~ root at localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr />
<address>Apache/2.0.48 (Gentoo/Linux) mod_python/3.0.4 Python/2.3.3
mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2 Server at cube.localdomain Port
80</address>
</body></html>

To avoid that I have to raise the apache.OK exception instead of just
returning.

cf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAVNAEoaQ1/feGlJoRAm5PAJ9qtoImr+bKLvDbqEOZc2Vhiwf0BwCdHAzk
U+rq4Emf5ICGZsVX8SSSueM=
=1fPn
-----END PGP SIGNATURE-----


More information about the Mod_python mailing list