[X2Go-Commits] [python-x2go] 02/03: x2go/client.py: Add with_command option to list_sessions() method.

git-admin at x2go.org git-admin at x2go.org
Sat May 12 23:32:48 CEST 2018


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

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

commit f89baa4e4c810f3f1b30e8ce080769d0f996fb43
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat May 12 23:31:35 2018 +0200

    x2go/client.py: Add with_command option to list_sessions() method.
---
 x2go/client.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/x2go/client.py b/x2go/client.py
index 83746f5..98deb67 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -127,6 +127,7 @@ import copy
 import sys
 import types
 import os
+import re
 
 # Python X2Go modules
 from .registry import X2GoSessionRegistry
@@ -2580,6 +2581,7 @@ class X2GoClient(object):
                       no_cache=False, refresh_cache=False,
                       update_sessionregistry=True,
                       register_sessions=False,
+                      with_command=None,
                       raw=False):
         """\
         Use the X2Go session registered under ``session_uuid`` to
@@ -2654,6 +2656,14 @@ class X2GoClient(object):
             self.session_registry.register_available_server_sessions(profile_name=self.get_session_profile_name(session_uuid),
                                                                      session_list=_session_list)
 
+        # filter out sessions that are not of a given command
+        if with_command:
+            _filtered_session_list = copy.deepcopy(_session_list)
+            for _session in list(_session_list.keys()):
+                if not re.match('.*_stD{cmd}_dp.*'.format(cmd=with_command), _session):
+                    del _filtered_session_list[_session]
+            _session_list = _filtered_session_list
+
         return _session_list
     __list_sessions = list_sessions
 

--
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