add 'none' to boolean and make context for rnederTemplate optional
This commit is contained in:
parent
4c19e55f1a
commit
3aeea06f55
|
@ -20,7 +20,7 @@ def boolean(v, fail=True):
|
||||||
'''convert string to True'''
|
'''convert string to True'''
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif value in [0, False, None, 'off', 'n', 'no', 'false', 'disable', '']:
|
elif value in [0, False, None, 'off', 'n', 'no', 'false', 'disable', 'none', '']:
|
||||||
'''convert string to False'''
|
'''convert string to False'''
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ def setup(fwork='sanic'):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def renderTemplate(tplfile, context, request=None, headers=dict(), cookies=dict(), **kwargs):
|
def renderTemplate(tplfile, context={}, request=None, headers=dict(), cookies=dict(), **kwargs):
|
||||||
if not isinstance(context, dict):
|
if not isinstance(context, dict):
|
||||||
raise TypeError(f'context for {tplfile} not a dict')
|
raise TypeError(f'context for {tplfile} not a dict')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue