In a certain project, I have many views that have multiple @view_configs 
that follow a few patterns; roughly something like this:

    @view_config(route_name="a", renderer="1")
    @view_config(route_name="a:a", renderer="1")
    @view_config(route_name="a:a.json", renderer="json")
    @view_config(route_name="a:b", renderer="1")
    @view_config(route_name="a:b.json", renderer="json")
    def view(request):
        pass

I'd like to simplify this with something like

    @view_config(route_name="a", renderer="1", route_pattern="foo")
    def view(request):
        pass

Then, based on "foo", programmatically generate what the other view_configs 
would have been and register them into Pyramid.

I got inspired for this idea with view derivers, and thought I could pull 
this off with a custom decorator that creates the view_configs, but the 
more I look into how view_config works, I don't think I can pull this off 
in a non-fragile way.

Has anyone tried to do something like this before and can offer tips?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/pylons-discuss/6fc32701-b9aa-4542-bddf-c504d9b5ef48n%40googlegroups.com.

Reply via email to