[X2Go-Commits] python-x2go.git - build-baikal (branch) updated: 0.1.1.4-161-g83a1d29

X2Go dev team git-admin at x2go.org
Wed Jan 8 15:26:55 CET 2014


The branch, build-baikal has been updated
       via  83a1d2999db1627f10440efb800843565f13425d (commit)
      from  7729459067a4f3c334157c8b5ce061e3949d2776 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 debian/changelog |    3 ++-
 x2go/utils.py    |   24 ++++++++++++++----------
 x2go/xserver.py  |   13 ++++++++-----
 3 files changed, 24 insertions(+), 16 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index fccff69..8d5ab27 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -65,7 +65,8 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
     - Normalize paths to configuration files.
     - Make new ini config defaults available in configurations, update list
       of known X-Servers if new ones are provided in defautlts.py.
-    - Provide function merge_sorted_lists in utils.py.
+    - Provide function merge_ordered_lists in utils.py, merge list of
+      default known_xservers with configured known_xservers.
   * Depend on python-xlib.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Sat, 28 Sep 2012 01:44:21 +0100
diff --git a/x2go/utils.py b/x2go/utils.py
index 131a7ae..1703cc5 100644
--- a/x2go/utils.py
+++ b/x2go/utils.py
@@ -524,17 +524,17 @@ def raise_session_window(session_window):
     """
     pass
 
-def merge_sorted_lists(l1, l2):
+def merge_ordered_lists(l1, l2):
     """\
     Merge sort two sorted lists
 
     @param l1: first sorted list
     @type l1: C{list}
     @param l2: second sorted list
-    @type l2: second sorted list
+    @type l2: C{list}
 
     """
-    sorted_list = []
+    ordered_list = []
 
     # Copy both the args to make sure the original lists are not
     # modified
@@ -542,14 +542,18 @@ def merge_sorted_lists(l1, l2):
     l2 = l2[:]
 
     while (l1 and l2):
-        if (l1[0] <= l2[0]): # Compare both heads
-            item = l1.pop(0) # Pop from the head
-            sorted_list.append(item)
-        else:
+        if l1[0] not in l2:
+            item = l1.pop(0)
+        elif l2[0] not in l1:
             item = l2.pop(0)
-            sorted_list.append(item)
+        elif l1[0] in l2:
+            item = l1.pop(0)
+            l2.remove(item)
+        if item not in ordered_list:
+            ordered_list.append(item)
 
     # Add the remaining of the lists
-    sorted_list.extend(l1 if l1 else l2)
+    ordered_list.extend(l1 if l1 else l2)
+
+    return ordered_list
 
-    return sorted_list
diff --git a/x2go/xserver.py b/x2go/xserver.py
index aa4c203..79e97a7 100644
--- a/x2go/xserver.py
+++ b/x2go/xserver.py
@@ -35,13 +35,14 @@ import os
 import threading
 import gevent
 import copy
+import heapq
 
 # Python X2Go modules
 import log
 from defaults import X2GO_XCONFIG_CONFIGFILES as _X2GO_XCONFIG_CONFIGFILES
 from defaults import X2GO_CLIENTXCONFIG_DEFAULTS as _X2GO_CLIENTXCONFIG_DEFAULTS
 import inifiles
-
+import utils
 
 class X2goClientXConfig(inifiles.X2goIniFile):
     """\
@@ -84,9 +85,8 @@ class X2goClientXConfig(inifiles.X2goIniFile):
             raise OSNotSupportedException('classes of x2go.xserver module are for Windows only')
 
         inifiles.X2goIniFile.__init__(self, config_files, defaults=defaults, logger=logger, loglevel=loglevel)
-        _known_xservers = self.known_xservers
-        for xserver in self.defaultValues['XServers']['known_xservers']:
-            if xserver not in self.known_xservers: _known_xservers.append(xserver)
+
+        _known_xservers = utils.merge_ordered_lists(self.defaultValues['XServers']['known_xservers'], self.known_xservers)
         self.update_value('XServers', 'known_xservers', _known_xservers)
 
     def get_xserver_config(self, xserver_name):
@@ -102,7 +102,10 @@ class X2goClientXConfig(inifiles.X2goIniFile):
         """
         _xserver_config = {}
         for option in self.iniConfig.options(xserver_name):
-            _xserver_config[option] = self.get(xserver_name, option, key_type=self.get_type(xserver_name, option))
+            try:
+                _xserver_config[option] = self.get(xserver_name, option, key_type=self.get_type(xserver_name, option))
+            except KeyError:
+                pass
         return _xserver_config
 
     @property


hooks/post-receive
-- 
python-x2go.git (Python X2Go Client API)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).




More information about the x2go-commits mailing list