[X2Go-Commits] python-x2go.git - twofactorauth (branch) updated: 6607484aa765425af31fb62819eb4a7332598a35

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:55:18 CEST 2013


The branch, twofactorauth has been updated
       via  6607484aa765425af31fb62819eb4a7332598a35 (commit)
      from  29b4c7f2e0b4adea74994b2dc839da8ea9f05e75 (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:
 x2go/defaults.py |    1 +
 x2go/printing.py |   32 ++++++++++++++++++++------------
 x2go/utils.py    |    4 ++--
 3 files changed, 23 insertions(+), 14 deletions(-)

The diff of changes is:
diff --git a/x2go/defaults.py b/x2go/defaults.py
index 60a91e0..1b4ce5c 100644
--- a/x2go/defaults.py
+++ b/x2go/defaults.py
@@ -208,6 +208,7 @@ from printing import X2goPrintActionPDFVIEW
 from printing import X2goPrintActionPDFSAVE
 from printing import X2goPrintActionPRINT
 from printing import X2goPrintActionPRINTCMD
+
 X2GO_PRINT_ACTIONS = {
     'PDFVIEW': X2goPrintActionPDFVIEW,
     'PDFSAVE': X2goPrintActionPDFSAVE,
diff --git a/x2go/printing.py b/x2go/printing.py
index ccf373f..a3341a7 100644
--- a/x2go/printing.py
+++ b/x2go/printing.py
@@ -45,12 +45,15 @@ import ConfigParser
 if sys.platform == 'win32':
     import win32api
 
+
 # Python X2go modules
 import log
 import defaults
+# we have to import the X2GO_PRINT_ACTIONS in this awkward way, otherwise we create an import loop
 from defaults import LOCAL_HOME as _LOCAL_HOME
 from defaults import X2GO_CLIENT_ROOTDIR as _X2GO_CLIENT_ROOTDIR
-from defaults import X2GO_CLIENTPRINTING_DEFAULTS
+from defaults import X2GO_CLIENTPRINTING_DEFAULTS as _X2GO_CLIENTPRINTING_DEFAULTS
+from defaults import X2GO_PRINTING_CONFIGFILES as _X2GO_PRINTING_CONFIGFILES
 import utils
 import inifiles
 
@@ -63,9 +66,9 @@ class X2goClientPrinting(inifiles.X2goIniFile):
     """
     config_files = []
     _print_action = None
-    defaultValues = defaults.X2GO_CLIENTPRINTING_DEFAULTS
+    defaultValues = _X2GO_CLIENTPRINTING_DEFAULTS
 
-    def __init__(self, config_files=defaults.X2GO_PRINTING_CONFIGFILES, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT):
+    def __init__(self, config_files=_X2GO_PRINTING_CONFIGFILES, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT):
         """\
         STILL UNDOCUMENTED
 
@@ -100,7 +103,7 @@ class X2goClientPrinting(inifiles.X2goIniFile):
 
         elif not _general_pdfview and not _print_startcmd:
             _cups_defaultprinter = self.get('CUPS', 'defaultprinter')
-            self._print_action = X2goPrintActionPRINT(default_printer=_cups_defaultprinter, logger=self.logger)
+            self._print_action = X2goPrintActionPRINT(printer=_cups_defaultprinter, logger=self.logger)
 
         elif not _general_pdfview and _print_startcmd:
             _print_command = self.get('print', 'command')
@@ -267,18 +270,22 @@ class X2goPrintActionPRINT(X2goPrintAction):
             )
         else:
             if self.printer is None:
-                cmd_line = [ 'lpr -h -r',
-                             '-J "%s"' % job_title, 
-                             '"%s"' % _hr_filename,
+                cmd_line = [ 'lpr',
+                             '-h',
+                             '-r',
+                             '-J%s' % job_title, 
+                             '%s' % _hr_filename,
                            ]
             else:
-                cmd_line = [ 'lpr -h -r',
+                cmd_line = [ 'lpr',
+                             '-h',
+                             '-r',
                              '-P%s' % self.printer,
-                             '-J "%s"' % job_title, 
-                             '"%s"' % _hr_filename,
+                             '-J%s' % job_title, 
+                             '%s' % _hr_filename,
                            ]
             self.logger('executing local print command: %s' % " ".join(cmd_line), loglevel=log.loglevel_DEBUG)
-            lpr = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=_PRINT_ENV)
+            p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=_PRINT_ENV)
 
         # this is nasty!!!!
         gevent.sleep(20)
@@ -333,7 +340,8 @@ class X2goPrintQueue(threading.Thread):
         self.logger.tag = __NAME__
 
         self.spool_dir = spool_dir
-        self.set_print_action(print_action, logger=logger, **print_action_args)
+        if print_action is not None:
+            self.set_print_action(print_action, logger=logger, **print_action_args)
         threading.Thread.__init__(self)
         self.daemon = True
         self._accept_jobs = True
diff --git a/x2go/utils.py b/x2go/utils.py
index cb5a2c7..0ecd4f2 100644
--- a/x2go/utils.py
+++ b/x2go/utils.py
@@ -31,7 +31,7 @@ import copy
 import paramiko
 
 # Python X2go modules
-import defaults
+from defaults import _pack_methods_nx3
 
 
 def is_in_nx3packmethods(method):
@@ -40,7 +40,7 @@ def is_in_nx3packmethods(method):
     Test if a given compression method is valid for NX3 Proxy.
 
     """
-    return method in defaults._pack_methods_nx3
+    return method in _pack_methods_nx3
 
 
 def find_session_line_in_x2golistsessions(session_name, x2go_stdout):


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