On Tue, Jun 4, 2013 at 1:12 PM, wilk <[email protected]> wrote:

> On 03-06-2013, tonthon wrote:
> > Hi,
> >
> > you can also use inline view declaration in place of decorators:
> >
> > config.add_route('p1', '/p1')
> > config.add_view(Main, route_name='p1')
> >
> > Combining this with the __import__ tool, you may achieve your goal quite
> > easily.
>
> Yes, i can do that, i'll make a litle shortcut function for this now and
> begin slowly to try with decorator if it's the recomended way.
>
> Currently i don't see why this design ?
> I mean why not one fonction to link route with view or one decorator
> with route pattern ?
>
> I think i missed something...


The reason there are 2 calls is because a 'route' doesn't map 1 to 1 with a
'view'

For example, you might have 2 views:   get_user_ajax  and get_user_html and
want to use the same route /get_user  but based on if it is an xhr request
or not a different view will get hit.

You also might want to map multiple routes to a single view, for example if
you create v2 of your API but some of your views didn't change, you can
just have a route on /v2/ that maps to the /v1/ view.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to