On Tue, 2011-09-13 at 15:05 +0100, Benjamin Sims wrote:
> 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)


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

It's slightly different in 1.0, but the above works in 1.1 and 1.2.

- C


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

Reply via email to