On Wed, Jul 20, 2011 at 1:31 PM, Marius Gedminas <[email protected]> wrote:
> On Wed, Jul 20, 2011 at 09:52:26AM -0700, Mike Orr wrote:
>> * HTML 5 has a lame-brained definition of boolean attributes. If the
>> attribute has any value including '', it's true. To make the attribute
>> false you have to remove it completely. That's impossible to express
>> in a 'kw = value' expression, so you'd have to have something
>> higher-level than that.
>
> You could have a convention that attributes specified as 'kw = value'
> expressions are omitted from the output when the value evaluates to
> None.  Zope Page Templates act like that

Actually, the tag helpers do that already.

h.select("name", [], ["A", "B"],
    disabled="disabled" if not IS_ENABLED else None)

So that's the shortest way to set a boolean attribute that the helper
doesn't have syntactical support for.

-- 
Mike Orr <[email protected]>

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