Coverage for tw2/core/jinja_util.py : 40%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from copy import copy
2from six.moves import filter
4_BOOLEAN_ATTRS = frozenset(['selected', 'checked', 'compact', 'declare',
5 'defer', 'disabled', 'ismap', 'multiple',
6 'nohref', 'noresize', 'noshade', 'nowrap'])
8def htmlbools(v):
9 attrs = copy(v)
10 for key in filter(lambda k: k in _BOOLEAN_ATTRS, attrs.keys()):
11 if attrs[key]:
12 attrs[key] = key
13 else:
14 attrs[key] = None
15 return attrs