On Mon, 2012-03-19 at 11:42 -0700, Mike Orr wrote:
> On Mon, Mar 19, 2012 at 11:13 AM, Chris McDonough <[email protected]> wrote:
> > On Mon, 2012-03-19 at 11:04 -0700, Mike Orr wrote:
> >
> >> So it sounds like Lukasz is asking for a way to make a view with
> >> customizable output. I can see a possibility for this if the view is
> >> written to use "something" that can be overridden. I'm not sure where
> >> to go from there, or what kind of plugin mechanism would be suitable.
> >> Can overriding assets be used for more than just static files? Or
> >> would ZCA be useful in this case (and not overkill)?
> >
> > ZCA is probably not really useful here.
> >
> > What I think Lukasz is asking for is an example of how to use the
> > existing include() machinery to include some configuration that
> > registers one or more views.
> 
> Yes, it depends on whether he wants to add views or customize existing
> views. I thought his "takes something from a database, and displays it
> in a different way" meant he wants to customize existing views.

Yeah.

Note that due to the way configuration conflict resolution works, if you
have a project that has an includeme like this:

def includeme(config):
    config.add_route('bar', '/bar')
    config.add_view('myproject.foo', route_name='bar')

.. and you do this ..

config = Configurator()
config.include(myproject.includeme)
config.add_view('thisproject.foo', route_name='bar')

.. the 'thisproject.foo' view will override the 'myproject.foo' view (it
is "more specific"; configuration statements that take place "closer to
the configurator" aka "at a lower include level" will override one that
takes place at a greater include level.  This is documented in
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/advconfig.html#automatic-conflict-resolution

The rest of the information in that chapter describes other facilities
which allow for overriding of configuration statements, such as
strategically using config.commit().

The asset override stuff also allows you to switch templates for a given
view, if that's all you need.  It's documented at
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/assets.html#overriding-assets

- 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