[X2Go-Commits] python-x2go.git - twofactorauth (branch) updated: 0.0.38.0-64-g07fc893
X2Go dev team
git-admin at x2go.org
Sat Sep 14 15:56:17 CEST 2013
The branch, twofactorauth has been updated
via 07fc893fe910b501909124b8ca8985cf941da97f (commit)
from 92ff5a7d7d612fcb7b7599ee0dc20367191493ef (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/backends/printing/_file.py | 65 +++++++++++++++++++++++++++++++--------
x2go/x2go_exceptions.py | 3 +-
2 files changed, 54 insertions(+), 14 deletions(-)
The diff of changes is:
diff --git a/x2go/backends/printing/_file.py b/x2go/backends/printing/_file.py
index 826712d..d8e1b48 100644
--- a/x2go/backends/printing/_file.py
+++ b/x2go/backends/printing/_file.py
@@ -38,6 +38,26 @@ import x2go.printactions as printactions
from x2go.defaults import X2GO_CLIENTPRINTING_DEFAULTS as _X2GO_CLIENTPRINTING_DEFAULTS
from x2go.defaults import X2GO_PRINTING_CONFIGFILES as _X2GO_PRINTING_CONFIGFILES
import x2go.inifiles as inifiles
+import x2go.x2go_exceptions as x2go_exceptions
+
+_print_property_map = {
+ 'pdfview_cmd': {
+ 'ini_section': 'view',
+ 'ini_option': 'command',
+ },
+ 'save_to_folder': {
+ 'ini_section': 'save',
+ 'ini_option': 'folder',
+ },
+ 'printer': {
+ 'ini_section': 'CUPS',
+ 'ini_option': 'defaultprinter',
+ },
+ 'print_cmd': {
+ 'ini_section': 'print',
+ 'ini_option': 'command',
+ },
+}
class X2goClientPrintingFILE(inifiles.X2goIniFile):
"""\
@@ -133,7 +153,36 @@ class X2goClientPrintingFILE(inifiles.X2goIniFile):
else:
return self._print_action
- def set_print_action(self, print_action, **kwargs):
+ def get_property(self, print_property):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ if print_property in _print_property_map.keys():
+ _ini_section = _print_property_map[print_property]['ini_section']
+ _ini_option = _print_property_map[print_property]['ini_option']
+ return self.get_value(_ini_section, _ini_option)
+ else:
+ raise x2go_exceptions.X2goClientPrintingException('No such X2go client printing property ,,%s\'\'' % print_property)
+
+ def set_property(self, print_property, value):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ if print_property in _print_property_map.keys():
+ _ini_section = _print_property_map[print_property]['ini_section']
+ _ini_option = _print_property_map[print_property]['ini_option']
+ _default_type = self.get_type(_ini_section, _ini_option)
+ if type(value) is types.UnicodeType:
+ value = value.encode('utf-8')
+ if _default_type != type(value):
+ raise x2go_exceptions.X2goClientPrintingException('Type mismatch error for property ,,%s\'\' - is: %s, should be: %s' % (print_property, str(type(value)), str(_default_type)))
+ self.update_value(_ini_section, _ini_option, value)
+ else:
+ raise x2go_exceptions.X2goClientPrintingException('No such X2go client printing property ,,%s\'\'' % print_property)
+
+ def store_print_action(self, print_action, **print_properties):
"""\
STILL UNDOCUMENTED
@@ -159,16 +208,6 @@ class X2goClientPrintingFILE(inifiles.X2goIniFile):
self.update_value('General', 'pdfview', False)
self.update_value('print', 'startcmd', True)
- if kwargs.has_key('pdfview_cmd'):
- self.update_value('view', 'command', kwargs['pdfview_cmd'])
-
- if kwargs.has_key('save_to_folder'):
- self.update_value('save', 'folder', kwargs['save_to_folder'])
-
- if kwargs.has_key('printer'):
- self.update_value('CUPS', 'defaultprinter', kwargs['printer'])
-
- if kwargs.has_key('print_cmd'):
- self.update_value('print', 'command', kwargs['print_cmd'])
-
+ for print_property in print_properties.keys():
+ self.set_property(print_property, print_properties[print_property])
diff --git a/x2go/x2go_exceptions.py b/x2go/x2go_exceptions.py
index 22a98fb..917e50e 100644
--- a/x2go/x2go_exceptions.py
+++ b/x2go/x2go_exceptions.py
@@ -41,6 +41,8 @@ SSHException = paramiko.SSHException
class _X2goException(exceptions.BaseException): pass
class X2goClientException(_X2goException): pass
+class X2goClientPrintingException(_X2goException): pass
+class X2goClientSettingsException(_X2goException): pass
class X2goSessionException(_X2goException): pass
class X2goControlSessionException(_X2goException): pass
class X2goHostKeyException(_X2goException): pass
@@ -50,7 +52,6 @@ class X2goSessionCacheException(_X2goException): pass
class X2goUserException(_X2goException): pass
class X2goProfileException(_X2goException): pass
class X2goSessionRegistryException(_X2goException): pass
-class X2goSettingsException(_X2goException): pass
class X2goFwTunnelException(_X2goException): pass
class X2goRevFwTunnelException(_X2goException): pass
class X2goPrintException(_X2goException): pass
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