Coverage for tw2.core.mako_util : 83%

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
#from mako.filters import xml_escape
'defer', 'disabled', 'ismap', 'multiple', 'nohref', 'noresize', 'noshade', 'nowrap'])
# Emulates Genshi's AttrsDirective (poorly) args = dict(args) else:
for k, v in six.iteritems(args) if (k not in bools and v is not None) or (k in bools and v)]
""" Backwards compatible widget attribute access.
In tw1, all template attributes looked like: ${some_attribute}
Whereas in tw2 they look like: ${w.some_attribute}
This is a *nuisance* if you want to reuse a template between tw1 and tw2 widgets. With this function you can write: <%namespace name="tw" module="tw2.core.mako_util"/> ${tw.compat(attr='some_attribute')} or ${tw._('some_attribute')}
Nice, right? :) """
if not 'w' in context.keys(): # Must be tw1 return context.get(attr) else: # Must be tw2 return getattr(context.get('w'), attr)
|