On Wed, Mar 18, 2009 at 07:31:36AM -0400, Tres Seaver wrote: > 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()).
object() is true in boolean contexts. > >> 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). True values also. This is a feature of TAL in HTML mode and should be preserved <input type="checkbox" tal:attributes="checked some_bool_expr" /> Marius Gedminas -- http://pov.lt/ -- Zope 3 consulting and development
Description: Digital signature
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )