Pyramid provides several options to call views or templates from inside
your application code.
They make quite easy to reuse templates and views.
See "pyramid.renderers" for template rendering or "pyramid.view" for views.

e.g.
    from pyramid.view import render_view

    ...
    return render_view(context, request, view_name, secure)

invokes the view including template lookup, security and so on.

Or

    from pyramid.renderers import render

    ...
    html = render("one_template.pt", {}, request=request)

gives you control over the template to be rendered.

Arndt.


2012/11/7 Marten <[email protected]>

> Hello,
>
> I searched a lot through documentation and examples, but I couldn't find
> any best practise on how to tie together a bunch of views to one page.
>
> You'll surely know dashbords that contain dozends of containers like load
> graphs, contact details, latest tasks in history, pending transactions of
> whatever ... Each container on its own is a usual view that renders fine on
> its own, but there has to be some master page, that includes all these
> views. And it would be crazy to prepare all data in one view and feed a
> mega-template.
>
> As similar problem arised during my development, when handling non-static
> headers like menu tree and user profile ("Hello <name>!" or "Login"). I
> know how to define a template so it loads a surrounding master template,
> but I don't know how to tell feed that with data. I also know how to bind a 
> subscriber
> to a new request, but that would be processed before the view is called.
> And especially regarding a login view it depends on whether the login
> attempt was successful or not which "Hello <name>!" or "Login" has to be
> rendered in the surrounding template. I think the views itself shouldn't
> know anything about menus and user details. Access permissions can be
> defined by roles on views.
>
> What is the best practise to do such things? Can you refer to any public
> source code on git (was well as a working website running this code so I
> see if it does what I mean) or examples in documentation? Thanks.
>
> Kind regards
> Marten
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pylons-discuss/-/0quNBRga8dMJ.
> 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.
>



-- 
DV Electric / Arndt Droullier / Nive cms cms.nive.co

-- 
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