Mercurial > libervia-web
changeset 1305:db9ea167c409
pages: `profile` is now exposed to scripts
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 16 Jul 2020 09:08:50 +0200 |
parents | 70e3341d25bf |
children | c07112ef01cd |
files | libervia/server/pages.py libervia/server/server.py |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ -953,8 +953,7 @@ "previous_page_url" and "next_page_url" will be added using respectively "before" and "after" URL parameters @param request(server.Request): current HTTP request - @param pubsub_data(dict): pubsub metadata parsed with - data_objects.parsePubSubMetadata + @param pubsub_data(dict): pubsub metadata """ template_data = request.template_data try: @@ -1398,7 +1397,8 @@ theme = session_data.theme or self.default_theme self.exposeToScripts( request, - templates_root_url=str(self.vhost_root.getFrontURL(theme))) + templates_root_url=str(self.vhost_root.getFrontURL(theme)), + profile=session_data.profile) return self.host.renderer.render( self.template,
--- a/libervia/server/server.py Thu Jul 16 09:08:50 2020 +0200 +++ b/libervia/server/server.py Thu Jul 16 09:08:50 2020 +0200 @@ -1049,7 +1049,9 @@ log.error(_("/!\\ Session has already a profile, this should NEVER happen!")) raise failure.Failure(exceptions.ConflictError("Already active")) - sat_session.profile = profile + # XXX: we force string because python D-Bus has its own string type (dbus.String) + # which may cause trouble when exposing it to scripts + sat_session.profile = str(profile) self.prof_connected.add(profile) cache_dir = os.path.join( self.cache_root_dir, "profiles", regex.pathEscape(profile)