bug fix: environment context throws an error on null

This commit is contained in:
Steve Nyemba 2022-10-20 18:41:37 -05:00
parent 7426705ffb
commit 1fea2e5f39
1 changed files with 4 additions and 1 deletions

View File

@ -45,16 +45,19 @@ class components :
_submenu[_index] = _item
_index += 1
return _object
def html(uri,id,_args=None) :
def html(uri,id,_args={}) :
"""
This function reads a given uri and returns the appropriate html document, and applies environment context
"""
_html = (open(uri)).read()
#return ' '.join(['<div id=":id" class=":id">'.replace(':id',id),_html,'</div>'])
_html = ' '.join(['<div id=":id" class=":id">'.replace(':id',id),_html,'</div>'])
appContext = Environment(loader=BaseLoader()).from_string(_html)
return appContext.render(**_args)
# return _html
def data (_args):
"""
:store data-store parameters (data-transport, github.com/lnyemba/data-transport)