web.py 0.3 notfound

8 views
Skip to first unread message

rkm...@gmail.com

unread,
Jun 2, 2008, 7:29:06 PM6/2/08
to we...@googlegroups.com
What is the right way of doing custom 404 not founds?

this does not work:

def newnotfound():
return 'MY NOT FOUND'
web.webapi.notfound =newnotfound


If i do this, I get an error that says an argument is passed to the
function newnotfound, what is that argument?

web.application.notfound =newnotfound

what is the correct way to do this?

Paul

unread,
Oct 11, 2008, 1:31:23 AM10/11/08
to we...@googlegroups.com


---------- Forwarded message ----------

Date: Jun 2, 4:29 pm
Subject: web.py 0.3 notfound
To: web.py

Justin Davis

unread,
Oct 11, 2008, 1:50:52 PM10/11/08
to web.py
If version 0.3, notfound is a method on the application:

app = web.application(urls, globals())
app.notfound = newnotfound

Also, you're responsible for setting the status when you redefine the
not found. It should probably look like this:

def newnotfound():
web.ctx.status = "404 Not Found"
return "MY NOT FOUND"

-Justin

John

unread,
Oct 15, 2008, 1:44:13 AM10/15/08
to we...@googlegroups.com

thanks works like a charm

:) :) :)

Reply all
Reply to author
Forward
0 new messages