# HG changeset patch # User Goffi # Date 1594883330 -7200 # Node ID 70e3341d25bfd77e5672474188fd1669406e8193 # Parent a48fe20f60c7e2df72d234395f37495192bfc78f pages: take care of None/null when exposing a variable diff -r a48fe20f60c7 -r 70e3341d25bf libervia/server/pages.py --- a/libervia/server/pages.py Thu Jul 16 09:08:50 2020 +0200 +++ b/libervia/server/pages.py Thu Jul 16 09:08:50 2020 +0200 @@ -554,7 +554,11 @@ template_data = request.template_data scripts = template_data.setdefault("scripts", utils.OrderedSet()) for name, value in kwargs.items(): - scripts.add(Script(content=f"var {name}={value!r};")) + if value is None: + value = "null" + else: + value = repr(value) + scripts.add(Script(content=f"var {name}={value};")) def registerURI(self, uri_tuple, get_uri_cb): """Register a URI handler