Hi Isaac,
I'm not a Pyramid expert but I'd play with mapper parameter of add_view or
view_config for that.
Alex K
On Tuesday, July 17, 2012 9:53:49 AM UTC-4, Isaac Jurado wrote:
>
> Hello,
>
> I would like to know if there is a way to add a fallback view name
> when
> a context is found but none of the defined view names match. For
> example, from the following example application:
>
> # coding: utf8
> from pyramid.config import Configurator
>
> class Foo(dict):
> pass
>
> def make_root(request):
> return {'foo': Foo()}
>
> def foo(request):
> return request.subpath
>
> def bar(request):
> return {"whoami": "bar", "subpath": request.subpath}
>
> def start(global_config, **settings):
> config = Configurator(settings=settings)
> config.set_root_factory(make_root)
> config.add_view(foo, context=Foo, renderer="json")
> config.add_view(bar, name="bar", context=Foo, renderer="json")
> return config.make_wsgi_app()
>
> Traversal finds /foo and /foo/bar fine. However, would it be possible
> to configure a view (with context=Foo) to be used when the view_name
> is
> not found?
>
> Thanks in advance.
>
>
--
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/-/8V0aSo4j8ZIJ.
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.