comparison libervia/server/pages.py @ 1471:83dce05226ac

pages: workaround to expose variables coming from python-dbus
author Goffi <goffi@goffi.org>
date Fri, 15 Oct 2021 21:13:35 +0200
parents a410db730301
children b4cead3cea43
comparison
equal deleted inserted replaced
1470:837ae0c4b858 1471:83dce05226ac
575 template_data = request.template_data 575 template_data = request.template_data
576 scripts = template_data.setdefault("scripts", utils.OrderedSet()) 576 scripts = template_data.setdefault("scripts", utils.OrderedSet())
577 for name, value in kwargs.items(): 577 for name, value in kwargs.items():
578 if value is None: 578 if value is None:
579 value = "null" 579 value = "null"
580 elif isinstance(value, str):
581 # FIXME: workaround for subtype used by python-dbus (dbus.String)
582 # to be removed when we get rid of python-dbus
583 value = repr(str(value))
580 else: 584 else:
581 value = repr(value) 585 value = repr(value)
582 scripts.add(Script(content=f"var {name}={value};")) 586 scripts.add(Script(content=f"var {name}={value};"))
583 587
584 def registerURI(self, uri_tuple, get_uri_cb): 588 def registerURI(self, uri_tuple, get_uri_cb):