On Thu, Nov 11, 2010 at 12:58 AM, Wichert Akkerman <wich...@wiggy.net> wrote:
> On 11/11/10 09:30 , Mike Orr wrote:
>>
>> Could we name it 'u' and pretend that Pylons always had it? 'url' does
>> tend to conflict with local variables and I usually use 'u' for the
>> local variable in that case, so this would just reverse the practice.
>> And it would look OK next to 'c' and 'h'.
>
> For readability sake I would object to that. One-letter names are confusing
> to new people, and very likely to conflict with temporary variables.

This is one of those cases where purity interferes with practicality.
It's only three one-letter variables to learn, and they're widely used
all over templates so they'll seem like just part of the syntax. And
if you only have a 79-character line and you want to put the entire
expression or tag on one line, it gets difficult when the boilerplate
code extends to nine characters; that's over a tenth of the space just
for one of them.

                  1                  2                  3
    4                  5                  6                  7
1234567890123456789012345678901234567890123456789012345678901234567890123456789

More details <a href="${u('record',
id=c.incident_id)}"><strong>here</strong></a>.

More details <a href="${route_url('record',
id=c.incident_id)}"><strong>here</strong></a>.

More details ${h.link_to("here", u("record", id=c.incident_id))}.

More details ${h.link_to("here", route_url("record", id=c.incident_id))}.

Click <a href="${u('record', id=c.incident_id)}">yes</a> or <a
href="${u('record', id=c.incident_id)">
no</a> to cast your vote.

Click <a href="${rouute_url('record', id=c.incident_id)}">yes</a> or
<a href="${route_url('record', id=c.other_id)">no</a> to cast your vote.

Click ${h.link_to("yes", u("record", id=c.incident_id))} or
${h.link_to("no", u("record", id=c.incident_id)}
to cast your vote.

Click ${h.link_to("yes", route_url("record", id=c.incident_id))} or
${h.link_to("no", route_url("record", id=c.incident_id)} to cast your vote.

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.

-- 
Mike Orr <sluggos...@gmail.com>

-- 
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