# HG changeset patch # User Goffi # Date 1594883330 -7200 # Node ID db9ea167c409ce7a0f6bce0d8467ccf42a626b14 # Parent 70e3341d25bfd77e5672474188fd1669406e8193 pages: `profile` is now exposed to scripts diff -r 70e3341d25bf -r db9ea167c409 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 @@ -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, diff -r 70e3341d25bf -r db9ea167c409 libervia/server/server.py --- 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)