On Thu, Nov 11, 2010 at 7:51 AM, Wichert Akkerman <wich...@wiggy.net> wrote:

> On 11/11/10 13:48 , Chris Rossi wrote:
>
>>
>>
>> On Thu, Nov 11, 2010 at 6:40 AM, Wichert Akkerman <wich...@wiggy.net
>> <mailto:wich...@wiggy.net>> wrote:
>>
>>    On 11/11/10 12:38 , Wichert Akkerman wrote:
>>
>>        On 11/11/10 12:05 , Mike Orr wrote:
>>
>>            Since HTML is all about hyperlinks, it makes sense to give them
>>            special treatment, especially if you're trying to encourage
>>            people to
>>            always use URL generation rather than literal URLs for
>>            internal links,
>>            as Pylons does.
>>
>>
>>        Stick a py:with="u=request.route_url" at the top of you template
>>        if you
>>        want brevity?
>>
>>        My standard pattern is to expose a 'tools' object to templates
>>        which has
>>        a number of functions such as route_url, model_url, etc. for use in
>>        templates. I've never felt that having to spell <a
>>        href="${tools.route_url('personal+settings')}">..</a> is too long
>> or
>>        awkward.
>>
>>
>>    Relatedly: there are two completely different ways to generate a
>>    URL: model based and route based. Your suggestion to use 'url' or
>>    'u' would imply a document preference for one of the two, which I do
>>    not feel is warranted. As Chris said earlier in this thread both are
>>    just as useful and important.
>>
>> FWIW, since we're talking about definitions that are in people's
>> projects (via Paster templates) and not in Pyramid itself, I feel like
>> the stakes are probably lower than they would seem from this discussion.
>>  Couldn't the routes style templates define 'url' and not the traversal
>> style?  Or define 'url' differently based on which style of dispatch is
>> being used?  There aren't any Paster templates for hybrid apps are there?
>>
>
> I'm afraid that will cause confusion: people will have certain expectations
> when they encounter a Pylons 2 app, and it will be odd if 'url' behaves
> differently than they expect in 50% of the applications. A related worry is
> add-ons that may expect 'url' to behave in a certain way and as a result
> only work in 50% of the Pylons 2 projects.
>
> A reusable add on really shouldn't be making assumptions about those
globals, since they are technically speaking application specific.  (If
including them in the Paster template would make it tempting to people to
rely on them in arbitrary other applications, then you have an argument for
not having any render globals defined in the template at all.)  As far as
confusing users, that may be a legitimate concern but I suspect most people
will off working on their own projects and will tend to be using just one
style of dispatch or the other.  For those who do switch around, they can
probably keep track of the context their in and set their expectations
accordingly.

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-de...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to