diff libervia/server/pages.py @ 1506:ce879da7fcf7

server: fix `on_signal` callback
author Goffi <goffi@goffi.org>
date Thu, 23 Mar 2023 17:50:54 +0100
parents 409d10211b20
children 106bae41f5c8
line wrap: on
line diff
--- a/libervia/server/pages.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/server/pages.py	Thu Mar 23 17:50:54 2023 +0100
@@ -542,7 +542,7 @@
 
     def checkCSRF(self, request):
         session = self.host.getSessionData(
-            request, session_iface.ISATSession
+            request, session_iface.IWebSession
         )
         if session.profile is None:
             # CSRF doesn't make sense when no user is logged
@@ -1078,7 +1078,7 @@
             if profile != C.SERVICE_PROFILE:
                 #  only service profile is cached for now
                 return
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             locale = session_data.locale
             if locale == C.DEFAULT_LOCALE:
                 # no need to duplicate cache here
@@ -1159,7 +1159,7 @@
         profile = self.getProfile(request) or C.SERVICE_PROFILE
         identities = self.host.getSessionData(
             request,
-            session_iface.ISATSession
+            session_iface.IWebSession
         ).identities
         for e in entities:
             if e not in identities:
@@ -1276,7 +1276,7 @@
         else:
             template = "error/" + str(code) + ".html"
             template_data = request.template_data
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             if session_data.locale is not None:
                 template_data['locale'] = session_data.locale
             if self.vhost_root.site_name:
@@ -1338,7 +1338,7 @@
                 raise failure.Failure(exceptions.CancelError("subpage page is used"))
 
     def _prepare_dynamic(self, request):
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         # we need to activate dynamic page
         # we set data for template, and create/register token
         # socket_token = str(uuid.uuid4())
@@ -1359,7 +1359,7 @@
         template_data = request.template_data
 
         # if confirm variable is set in case of successfuly data post
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         template_data['identities'] = session_data.identities
         if session_data.popPageFlag(self, C.FLAG_CONFIRM):
             template_data["confirm"] = True
@@ -1441,7 +1441,7 @@
             raise NotImplementedError(
                 _("iterable in on_data_post return value is not used yet")
             )
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         request_data = self.getRData(request)
         if "post_redirect_page" in request_data:
             redirect_page_data = request_data["post_redirect_page"]
@@ -1470,7 +1470,7 @@
         except exceptions.DataError as e:
             # something is wrong with the posted data, we re-display the page with a
             # warning notification
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             session_data.setPageNotification(self, str(e), C.LVL_WARNING)
             request.setResponseCode(C.HTTP_SEE_OTHER)
             request.setHeader("location", request.uri)
@@ -1561,16 +1561,16 @@
         @return (unicode, None): current profile
             None if no profile session is started
         """
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.profile
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.profile
 
     def getJid(self, request):
         """Helper method to easily get current jid
 
         @return: current jid
         """
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.jid
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.jid
 
 
     def getRData(self, request):
@@ -1589,13 +1589,13 @@
 
     def getPageData(self, request, key):
         """Helper method to retrieve reload resistant data"""
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.getPageData(self, key)
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.getPageData(self, key)
 
     def setPageData(self, request, key, value):
         """Helper method to set reload resistant data"""
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.setPageData(self, key, value)
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.setPageData(self, key, value)
 
     def handleSearch(self, request, extra):
         """Manage Full-Text Search
@@ -1649,7 +1649,7 @@
             for a in available:
                 if a.lower().startswith(lang):
                     session_data = self.host.getSessionData(request,
-                                                            session_iface.ISATSession)
+                                                            session_iface.IWebSession)
                     session_data.locale = a
                     return
 
@@ -1659,7 +1659,7 @@
         if not hasattr(request, "template_data"):
             # if template_data doesn't exist, it's the beginning of the request workflow
             # so we fill essential data
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             profile = session_data.profile
             request.template_data = {
                 "profile": profile,