[X2go-Commits] python-x2go.git - master (branch) updated: 0.1.1.4-225-g7397c54

X2Go dev team git-admin at x2go.org
Tue Apr 24 10:01:52 CEST 2012


The branch, master has been updated
       via  7397c54e66e848a9a5803068ca024e989982bb92 (commit)
      from  831b545574f76a6562831d5bc6e70b2bce892d4b (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 -----------------------------------------------------------------
commit 7397c54e66e848a9a5803068ca024e989982bb92
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Apr 24 09:36:52 2012 +0200

    Make sure path names in X2goPrintActions and X2goMIMEboxActions get transformed to OS-specific path names.

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog       |    2 ++
 x2go/client.py         |   12 ++++++++----
 x2go/mimebox.py        |    1 +
 x2go/mimeboxactions.py |   12 ++++++++++++
 x2go/printactions.py   |   22 ++++++++++++++++++++--
 x2go/printqueue.py     |    1 +
 6 files changed, 44 insertions(+), 6 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 459982c..2daca74 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -116,6 +116,8 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
     - Try to derive language information from X2goClient instance.
     - Make timeout on command execution customizable.
     - Fix SSHException usage.
+    - Make sure path names in X2goPrintActions and X2goMIMEboxActions get
+      transformed to OS-specific path names.
   * Depend on python-xlib.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Sat, 28 Sep 2012 01:44:21 +0100
diff --git a/x2go/client.py b/x2go/client.py
index 2e217b8..749c081 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -278,7 +278,11 @@ class X2goClient(object):
         self.sessions_rootdir = sessions_rootdir or os.path.normpath(os.path.join(_LOCAL_HOME, _X2GO_SESSIONS_ROOTDIR))
         self.ssh_rootdir = ssh_rootdir or os.path.normpath(os.path.join(_LOCAL_HOME, _X2GO_SSH_ROOTDIR))
 
-        self.pulseaudio_installdir = pulseaudio_installdir
+        self.client_rootdir = os.path.normpath(self.client_rootdir)
+        self.sessions_rootdir = os.path.normpath(self.sessions_rootdir)
+        self.ssh_rootdir = os.path.normpath(self.ssh_rootdir)
+
+        self.pulseaudio_installdir = os.path.normpath(pulseaudio_installdir)
 
         if self.client_rootdir is not None:
             self._has_custom_client_rootdir = True
@@ -770,7 +774,7 @@ class X2goClient(object):
         @return: X2Go client root directory
         @rtype: C{str}
         """
-        return self.client_rootdir
+        return os.path.normpath(self.client_rootdir)
     __get_client_rootdir = get_client_rootdir
 
     @property
@@ -790,7 +794,7 @@ class X2goClient(object):
         @return: X2Go sessions root directory
         @rtype: C{str}
         """
-        return self.sessions_rootdir
+        return os.path.normpath(self.sessions_rootdir)
     __get_sessions_rootdir = get_sessions_rootdir
 
     def get_ssh_rootdir(self):
@@ -800,7 +804,7 @@ class X2goClient(object):
         @return: SSH client root directory
         @rtype: C{str}
         """
-        return self.ssh_rootdir
+        return os.path.normpath(self.ssh_rootdir)
     __get_ssh_rootdir = get_ssh_rootdir
 
     def get_client_username(self):
diff --git a/x2go/mimebox.py b/x2go/mimebox.py
index f79872d..ab4cd35 100644
--- a/x2go/mimebox.py
+++ b/x2go/mimebox.py
@@ -86,6 +86,7 @@ class X2goMIMEboxQueue(threading.Thread):
         self.profile_name = profile_name
         self.session_name = session_name
         self.mimebox_dir = mimebox_dir
+        if self.mimebox_dir: self.mimebox_dir = os.path.normpath(self.mimebox_dir)
         self.mimebox_extensions = mimebox_extensions
         self.client_instance = client_instance
         self.client_rootdir = client_instance.get_client_rootdir()
diff --git a/x2go/mimeboxactions.py b/x2go/mimeboxactions.py
index 0c8f908..676b321 100644
--- a/x2go/mimeboxactions.py
+++ b/x2go/mimeboxactions.py
@@ -118,6 +118,9 @@ class X2goMIMEboxAction(object):
         @type mimebox_dir: C{str}
 
         """
+        mimebox_file = os.path.normpath(mimebox_file)
+        mimebox_dir = os.path.normpath(mimebox_dir)
+
         gevent.spawn(self._do_process, mimebox_file, mimebox_dir, )
 
 
@@ -154,6 +157,9 @@ class X2goMIMEboxActionOPEN(X2goMIMEboxAction):
         @type mimebox_dir: C{str}
 
         """
+        mimebox_file = os.path.normpath(mimebox_file)
+        mimebox_dir = os.path.normpath(mimebox_dir)
+
         if _X2GOCLIENT_OS == "Windows":
             self.logger('opening incoming MIME box file with Python\'s os.startfile() command: %s' % mimebox_file, loglevel=log.loglevel_DEBUG)
             try:
@@ -209,6 +215,9 @@ class X2goMIMEboxActionOPENWITH(X2goMIMEboxAction):
         @type mimebox_dir: C{str}
 
         """
+        mimebox_file = os.path.normpath(mimebox_file)
+        mimebox_dir = os.path.normpath(mimebox_dir)
+
         if _X2GOCLIENT_OS == "Windows":
             self.logger('evoking Open-with dialog on incoming MIME box file: %s' % mimebox_file, loglevel=log.loglevel_DEBUG)
             win32api.ShellExecute (
@@ -269,6 +278,9 @@ class X2goMIMEboxActionSAVEAS(X2goMIMEboxAction):
         @param mimebox_file: PDF file name as placed in to the X2Go spool directory
 
         """
+        mimebox_file = os.path.normpath(mimebox_file)
+        mimebox_dir = os.path.normpath(mimebox_dir)
+
         self.logger('Session %s (%s) is calling X2goClient class hook method <client_instance>.HOOK_open_mimebox_saveas_dialog(%s)' % (self.session_name, self.profile_name, mimebox_file), loglevel=log.loglevel_NOTICE)
         self.client_instance.HOOK_open_mimebox_saveas_dialog(os.path.join(mimebox_dir, mimebox_file), profile_name=self.profile_name, session_name=self.session_name)
         time.sleep(60)
diff --git a/x2go/printactions.py b/x2go/printactions.py
index b40ee34..175100d 100644
--- a/x2go/printactions.py
+++ b/x2go/printactions.py
@@ -130,6 +130,9 @@ class X2goPrintAction(object):
         @type spool_dir: C{str}
 
         """
+        pdf_file = os.path.normpath(pdf_file)
+        spool_dir = os.path.normpath(spool_dir)
+
         self._do_print(pdf_file, job_title, spool_dir)
 
     def _humanreadable_filename(self, pdf_file, job_title, target_path):
@@ -146,12 +149,12 @@ class X2goPrintAction(object):
         @rtype: C{str}
 
         """
-        _hr_path = os.path.expanduser(os.path.join(target_path, '%s.pdf' % utils.slugify(job_title)))
+        _hr_path = os.path.normpath(os.path.expanduser(os.path.join(os.path.normpath(target_path), '%s.pdf' % utils.slugify(job_title))))
         i = 0
 
         while os.path.exists(_hr_path):
             i += 1
-            _hr_path = os.path.expanduser(os.path.join(target_path, '%s(%s).pdf' % (utils.slugify(job_title), i)))
+            _hr_path = os.path.normpath(os.path.expanduser(os.path.join(os.path.normpath(target_path), '%s(%s).pdf' % (utils.slugify(job_title), i))))
 
         return _hr_path
 
@@ -197,6 +200,9 @@ class X2goPrintActionPDFVIEW(X2goPrintAction):
         @type spool_dir: C{str}
 
         """
+        pdf_file = os.path.normpath(pdf_file)
+        spool_dir = os.path.normpath(spool_dir)
+
         if _X2GOCLIENT_OS == "Windows":
             self.logger('viewing incoming job in PDF viewer with Python\'s os.startfile( command): %s' % pdf_file, loglevel=log.loglevel_DEBUG)
             try:
@@ -279,6 +285,9 @@ class X2goPrintActionPDFSAVE(X2goPrintAction):
         @type spool_dir: C{str}
 
         """
+        pdf_file = os.path.normpath(pdf_file)
+        spool_dir = os.path.normpath(spool_dir)
+
         dest_file = self._humanreadable_filename(pdf_file, job_title, target_path=self.save_to_folder)
         shutil.copy2(pdf_file, dest_file)
 
@@ -320,6 +329,9 @@ class X2goPrintActionPRINT(X2goPrintAction):
         @type spool_dir: C{str}
 
         """
+        pdf_file = os.path.normpath(pdf_file)
+        spool_dir = os.path.normpath(spool_dir)
+
         _hr_filename = self._humanreadable_filename(pdf_file, job_title, spool_dir)
         if _X2GOCLIENT_OS == 'Windows':
             _default_printer = win32print.GetDefaultPrinter()
@@ -449,6 +461,9 @@ class X2goPrintActionPRINTCMD(X2goPrintAction):
         @type spool_dir: C{str}
 
         """
+        pdf_file = os.path.normpath(pdf_file)
+        spool_dir = os.path.normpath(spool_dir)
+
         _hr_filename = self._humanreadable_filename(pdf_file, job_title, spool_dir)
         shutil.copy2(pdf_file, _hr_filename)
         self.logger('executing external command ,,%s\'\' on PDF file %s' % (self.print_cmd, _hr_filename), loglevel=log.loglevel_NOTICE)
@@ -505,6 +520,9 @@ class X2goPrintActionDIALOG(X2goPrintAction):
         @type spool_dir: C{str}
 
         """
+        pdf_file = os.path.normpath(pdf_file)
+        spool_dir = os.path.normpath(spool_dir)
+
         self.logger('Session %s (%s) is calling X2goClient class hook method <client_instance>.HOOK_open_print_dialog' % (self.session_name, self.profile_name), loglevel=log.loglevel_NOTICE)
         _new_print_action = self.client_instance.HOOK_open_print_dialog(profile_name=self.profile_name, session_name=self.session_name)
         if type(_new_print_action) != type(self):
diff --git a/x2go/printqueue.py b/x2go/printqueue.py
index 28eca2c..3f3d10a 100644
--- a/x2go/printqueue.py
+++ b/x2go/printqueue.py
@@ -97,6 +97,7 @@ class X2goPrintQueue(threading.Thread):
         self.profile_name = profile_name
         self.session_name = session_name
         self.spool_dir = spool_dir
+        if self.spool_dir: self.spool_dir = os.path.normpath(self.spool_dir)
         self.client_instance = client_instance
         self.client_rootdir = client_instance.get_client_rootdir()
         self.printing_backend = printing_backend


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