Add "body" parameter to HTTPError?

1 view
Skip to first unread message

braydon fuller

unread,
Apr 21, 2008, 10:12:06 PM4/21/08
to cherryp...@googlegroups.com
Nicolas Grilly wrote:
braydon fuller <cou...@braydon.com> wrote:
  
 (...)
    
Braydon,

It seems your patch doesn't solve the same kind of problem.

Ticket #800 is about providing a way to customize the error page
returned by default by every HTTPError.

But your proposal, if I understand it well, is about adding a
parameter "body" to HTTPError, in order to customize the error page
returned by a specific instance of HTTPError.

If I am correct, we probably should discuss this in a dedicated
thread, with a descriptive title.
  
Correct, and not only a specific instance of HTTPError, but a specific instance of a 404 error, or any error for that matter.

braydon fuller

unread,
Apr 21, 2008, 10:14:13 PM4/21/08
to cherryp...@googlegroups.com
[sorry I forgot to include this reference]

I have also made a patch. Here I am able to send a complete html page
rather than a message:
http://groups.google.com/group/cherrypy-devel/browse_frm/thread/7ab58f345d8e650c

You send the whole page as "body", similar as sending a "message":

def foobar(uri):
try:
location = get_uri(uri)
data = get_data(location)
success = Template(file=filename, searchList=[data])
except:
error = Template(file=filename, searchList=[locals()])
raise HTTPError(404, body=error)
foobar.exposed = True


Reply all
Reply to author
Forward
0 new messages