[mod_python] Publisher Handler(my own http404)

stefano cirilli stefano.cirilli1 at virgilio.it
Mon May 8 08:12:33 EDT 2006

Hi all,
i'm trying to get my own http404 page, my configuration, in apache conf file(Apache 2.0.55, mod_python 3.2.8), looks like this:
<Directory htdocs/users/http404>
SetHandler mod_python
PythonHandler mod_python.publisher
My Python(2.4.3) code, in a module named "pagenotf.py":

from mod_python import apache
def index(req):
	if req.filename[-17:] == 'apache-error.html':
	if req.filename[-18:] == 'handler-error.html':
		req.status = apache.HTTP_NOT_FOUND
		pagebuffer = 'Page not here. Page left, not know where gone.'
		pagebuffer = open(req.filename, 'r').read()
	req.content_type = "text/plain"	

if i send, to my browser, this URL:
i receive an Http 404 response, "Page not found",
if i send

then i get a page with the python code. Is the same, if i try

How can i get(what's the URL), to display in my page, the content of the variable pagebuffer?


sets to "Page not here. Page left, not know where gone.".
Sincerely yours,
Stefano Cirilli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060508/35d66db0/attachment.html

More information about the Mod_python mailing list