Hi,

I'm trying to generate a custom 404 view for my application. I've read:

https://pylonsproject.org/projects/pyramid/dev/narr/hooks.html#changing-the-notfound-view

However, I want to be able to have the 404 use a Chameleon template with
macros and so forth in order to fit in with the overall look and feel.

I have:

config.add_view(notfound_view, renderer = 'templates/view_not_found.pt',
context=HTTPNotFound)

in the __init__, and:

def notfound_view(request):
    master = get_renderer('templates/macros_template.pt').implementation()
    return dict(master = master)

as the relevant view. However, while it will correctly give me the 404 page
I want to see, the HTTP header will be a 200 OK.

I'm aware that I can do:

def notfound_view(request):
    return HTTPNotFound()

however I then of course do not see my templated view.

Could somebody please expand on the documentation example and tell me what
calls I need to achieve this?

Thanks,
Ben

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to