> On Nov 11, 2015, at 2:01 PM, kk <[email protected]> wrote:
> 
> 
> Thanks,
> 
> 
> On Thursday 12 November 2015 12:28 AM, Jonathan Vanasco wrote:
>> @view_config is a decorator that registers the view callable function ( 
>> http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/viewconfig.html#adding-view-configuration-using-the-view-config-decorator
>>  )
>> 
>> The various arguments trigger the view.
> 
> But I read that this is a slow way specially during the startup of the web 
> app?  Is that correct?

The speed hit on startup comes from the other side, the part doing the 
config.scan(). It’s a very small hit only when you have a huge code base (lots 
of files to scan). Easily fixed as well. So don’t be afraid of @view_config. :)

>> 
>> There are other ways to register a view (such as `config.add_view`), but 
>> `@view_config` is very popular.
>> -- 
> So when using add_view, the rooting happens in the same line of code or is it 
> still done at a different place?

There are two parts to the dance:

- Routing looks at the URL and selects a route name based on the URL pattern 
and the order the routes were registered. Your config.add_route statements 
register those route names.

- Once you have a route name, you then need a view from the list of views 
registered for that route name. Your config.add_view (or @view_config) 
statements register views for a route name.

Jonathan, I liked your explanation of “a route is a way to make an identifier 
on a URL pattern”. 

—Paul

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to