Kevin Cole schrieb:
> On 9/24/07, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
>
>> Kid templates must be proper XML. Use this:
>>
>> <input type="text" readonly="$readonlyvar"/>
>
> Wouldn't it be better to make $readonlyvar equal the entire string
>
> readonly="readonly"
>
> That way, you're not left with [readonly=""] or
> [readonly="wonkyvalue"] when $readonlyvar is turned "off"...
What do you mean with "turned off"? You either set readonlyvar to None
or to "readonly". Or you can use this:
<input type="text" readonly="${readonlyvar and 'readonly' or None}"/>
Then you will get readonly="readonly" if and only if readonlyvar is a
Python value that is not false.
By the way, Kid will serialize this differently if you output HTML
instead of XHTML. In this case, you will get only "readonly".
(Just noticed that this does not work for "readonly", but only for other
boolean attributes such as "selected", "checked"; this seems to be a bug
in Kid.)
-- Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---