Closed JK-de closed 6 years ago
Added vars to WriteResponsePyHTMLFile() Now you can add variables to pyHTML-rendering like:
vars = {} vars['menu'] = 'devices' vars['device_list'] = GetList(...) return httpResponse.WriteResponsePyHTMLFile('www/devices_list.html', headers=None, vars=vars)
Added FlashMessage() Add a message or error display on NEXT pyHTML-rendering. It's important for redirected URLs like:
err, idx = Cmd.excecute(cmd) if err: msg = 'Error "{0}" - Can not add device "{1}"'.format(err, duid) httpResponse.FlashMessage(msg, 'danger') else: Cmd.excecute('save') msg = 'Device "{}" added'.format(duid) httpResponse.FlashMessage(msg, 'info') return httpResponse.WriteResponseRedirect('/devices')
with pyHTML;
{{ if MESSAGE_TEXT }} <div class="alert alert-{{ MESSAGE_STYLE }} hide" role="alert"> <strong>{{ MESSAGE_TEXT }}</strong> </div> {{ end }}
Added more flexibility to {{ if xxx }} The 'xxx' after the 'if' in pyHTML must be a bool - otherwise exception! Now:
You can check a variable before use it:
{{ if message }} <strong>{{ message }}</strong> {{ end }}
Yes :) It's cool ! I've merged that ! 👍
Added vars to WriteResponsePyHTMLFile() Now you can add variables to pyHTML-rendering like:
Added FlashMessage() Add a message or error display on NEXT pyHTML-rendering. It's important for redirected URLs like:
with pyHTML;
Added more flexibility to {{ if xxx }} The 'xxx' after the 'if' in pyHTML must be a bool - otherwise exception! Now:
You can check a variable before use it: