[Zope-dev] ZPT attributes and ""

Tres Seaver tseaver at palladion.com
Wed Mar 18 07:31:36 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roger Ineichen wrote:
> Hi Malthe
>   
>> Betreff: [Zope-dev] ZPT attributes and ""
>>
>> Currently, if an attribute expression evaluates to any value 
>> that's boolean False, it's omitted (e.g. 0, "", object()). I 
>> think that's unexpected. Instead, attributes should only be 
>> omitted when the expression evaluates to ``None``.
> 
> I think this is better then render empty strings. see below...
> 
>> How do folks feel about changing this behavior in 
>> ``zope.pagetemplate``.
> 
> Probably anything else then "" should be skipped. There is no
> logic why object() or False should get rendered as "".

Non-true values have special semantics for certain attributes
('checked', 'selected', I think).

> I only whould expect that an empty string whould get rendered
> as "". And probably we should check the HTML specification and
> make sure that we only render empty strings for attributes where
> they are allowed.
> 
> see:
> http://www.w3.org/TR/html401/types.html#type-name
> 
> ID and NAME tokens must begin with a letter ([A-Za-z]) and
> may be followed by any number of letters, digits ([0-9]),
> hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). 
> 
> This means to me that an empty value for id or name
> doen't start with [A-Za-z] and is invalid because is must start
> with [A-Za-z]. or not?

- -1 on making ZPT / chameleon responsible for enforcing that requirement:
that would be the application's job.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJwNuY+gerLs4ltQ4RAnvLAJ41d/7G0sHnH7GfX/CV9v+Dw6ksAQCgw+ZC
LfHPVXRoCkejJLyCvLjdvyU=
=ClnO
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list