add 'none' to boolean and make context for rnederTemplate optional

This commit is contained in:
Izalia Mae 2020-06-10 22:58:29 -04:00
parent 4c19e55f1a
commit 3aeea06f55
2 changed files with 2 additions and 2 deletions

View file

@ -20,7 +20,7 @@ def boolean(v, fail=True):
'''convert string to 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'''
return False

View file

@ -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):
raise TypeError(f'context for {tplfile} not a dict')