[X2Go-Commits] [python-x2go] 03/09: X2GoSessionInfo: Cache virtually immutable session type.

git-admin at x2go.org git-admin at x2go.org
Fri Jul 19 19:42:45 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository python-x2go.

commit 0fbaa83f566a695e965b61538c73dafab3d37867
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Jul 19 17:12:13 2019 +0200

    X2GoSessionInfo: Cache virtually immutable session type.
---
 debian/changelog            | 1 +
 x2go/backends/info/plain.py | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 03b997e..3bdcdb3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ python-x2go (0.6.0.3-0x2go1) UNRELEASED; urgency=medium
     - X2GoSessionInfo: Drop debug print command.
     - X2GoSessionInfo: Handle non-initialized X2GoSessionInfo instance
       more gracefully.
+    - X2GoSessionInfo: Cache virtually immutable session type.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Sat, 01 Dec 2018 02:16:45 +0100
 
diff --git a/x2go/backends/info/plain.py b/x2go/backends/info/plain.py
index c2be45f..52c672d 100644
--- a/x2go/backends/info/plain.py
+++ b/x2go/backends/info/plain.py
@@ -46,6 +46,7 @@ class X2GoServerSessionInfo(object):
     def __init__(self):
         self.initialized = False
         self.protected = False
+        self.session_type_cached = None
 
     def __str__(self):
         return self.name
@@ -140,11 +141,14 @@ class X2GoServerSessionInfo(object):
         :rtype: ``str`` or ``None`` (if not initialized)
 
         """
+        if self.session_type_cached is not None:
+            return self.session_type_cached
         if self.initialized:
             cmd = self.name.split('_')[1]
             session_type = cmd[2]
             if session_type == 'R' and self.is_published_applications_provider():
                 session_type = 'P'
+            self.session_type_cached = session_type
             return session_type
         else:
             return None
@@ -331,6 +335,7 @@ class X2GoServerSessionInfo(object):
         self.remote_container = ''
         self.protected = False
         self.initialized = False
+        self.session_type_cached = None
 
     def update(self, session_info):
         """\

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git


More information about the x2go-commits mailing list