Permalink
Browse files

Added jinja filter to take care of special case html bolean attribute…

…s such as radio checked}
  • Loading branch information...
clsdaniel committed Aug 4, 2012
1 parent 1269dff commit da25dbfafda1a593aa01bc01a31ef1c1c7bfd89f
Showing with 11 additions and 0 deletions.
  1. +11 −0 tw2/core/jinja_util.py
@@ -0,0 +1,11 @@
from copy import copy
_BOOLEAN_ATTRS = frozenset(['selected', 'checked', 'compact', 'declare',
'defer', 'disabled', 'ismap', 'multiple',
'nohref', 'noresize', 'noshade', 'nowrap'])
def htmlbools(v):
attrs = copy(v)
for key in filter(lambda k: k in _BOOLEAN_ATTRS and attrs[k], attrs.keys()):
attrs[key] = key
return attrs

0 comments on commit da25dbf

Please sign in to comment.