two questions one email

1- how can I add whitespace in html building, I find literal(' ')
ugly. The use case two tags inside a div
HTML.span('Welcome %s' % identity['repoze.who.userid'])+literal('
')+link_to('logout','/logout_handler')

2- why does link_to works as it does?

>>> link_to('foo')
literal(u'<a href="">foo</a>')
>>> link_to('foo','bar')
literal(u'<a href="bar">foo</a>')
>>> link_to(url='bar')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: link_to() takes at least 1 non-keyword argument (0 given)

that is totally unpythonic doesn't this seems a lot better?

>>> link_to('foo')
literal(u'<a href="foo">foo</a>')
>>> link_to('foo','bar')
literal(u'<a href="foo">bar</a>')
>>> link_to(url='bar')
literal(u'<a href="bar">bar</a>')

in fact the second form reads like english link to foo named bar

the second form just requires a change of signature.
def link_to(url, label='', **attrs):

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to