[mod_python] All power of mod_python in publisher handler ?

Mateusz Korniak mateusz at ant.gliwice.pl
Wed Aug 14 23:10:50 EST 2002


I'm in process of converting some 'pure' mod_python handlers to publishers 
one.
Basically my handlers looks like

def mod_python_handler(req):
	req.status = mod_python.apache.OK
	req.content_type = ....
	req.send_http_header()
	req.write(content_parts) 
	# many writes like above ...

	return mod_python.apache.OK

so I suppsed to proper equivalent publisher handler should look like:

def publisher_handler(req):
	mod_python_handler(req):

But any call of request.write() results an 500 Internal Server Error.
1) What I'm doing wrong ?
2) What I'm suposed to return from publisher_handler() when all what already 
send do browser via request.write() calls ?

Something opposite is cleanly stated in docs:
"And last, but not the least, note how all the power of mod_python is still 
available to this function, since it has access to the Request object. You 
can do all the same things you can do with a "native" mod_python handler, 
e.g. set custom headers via req.headers_out, return errors by raising 
apache.SERVER_ERROR exceptions, write or read directly to and from the client 
via req.write and req.read, etc. "

TIA
-- 
Mateusz Korniak





More information about the Mod_python mailing list