This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository python-x2go. commit 825b6972dd62eaeb64521486c34a9f936f3824ab Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Mar 5 16:46:26 2018 +0100 Various __doc__ string improvements and fixes. --- x2go/_paramiko.py | 4 +- x2go/backends/control/plain.py | 174 ++++++------ x2go/backends/info/plain.py | 28 +- x2go/backends/printing/file.py | 18 +- x2go/backends/printing/winreg.py | 1 + x2go/backends/profiles/base.py | 73 ++--- x2go/backends/profiles/file.py | 22 +- x2go/backends/profiles/httpbroker.py | 19 +- x2go/backends/proxy/base.py | 11 +- x2go/backends/proxy/nx3.py | 4 + x2go/backends/settings/file.py | 1 + x2go/backends/settings/winreg.py | 1 + x2go/backends/terminal/plain.py | 110 +++++--- x2go/cache.py | 32 ++- x2go/checkhosts.py | 15 +- x2go/cleanup.py | 4 +- x2go/client.py | 531 +++++++++++++++++------------------ x2go/forward.py | 23 +- x2go/guardian.py | 3 + x2go/inifiles.py | 12 +- x2go/log.py | 17 +- x2go/mimebox.py | 16 +- x2go/mimeboxactions.py | 9 + x2go/printactions.py | 14 +- x2go/printqueue.py | 18 +- x2go/pulseaudio.py | 6 +- x2go/registry.py | 183 ++++++------ x2go/rforward.py | 30 +- x2go/session.py | 256 ++++++++++------- x2go/sftpserver.py | 31 +- x2go/sshproxy.py | 12 + x2go/telekinesis.py | 13 +- x2go/tests/test_printing.py | 117 ++++---- x2go/utils.py | 37 +-- x2go/xserver.py | 19 +- 35 files changed, 1040 insertions(+), 824 deletions(-) diff --git a/x2go/_paramiko.py b/x2go/_paramiko.py index 278ae99..8d93ad7 100644 --- a/x2go/_paramiko.py +++ b/x2go/_paramiko.py @@ -59,7 +59,6 @@ def _SSHClient_save_host_keys(self, filename): @param filename: the filename to save to @type filename: str - @raise IOError: if the file could not be written """ @@ -94,7 +93,6 @@ def _HostKeys_load(self, filename): @param filename: name of the file to read host keys from @type filename: str - @raise IOError: if there was an error reading the file """ @@ -125,6 +123,8 @@ def _HostKeys_add(self, hostname, keytype, key, hash_hostname=True): @type keytype: str @param key: the key to add @type key: L{PKey} + @param hash_hostname: hash the system's hostname (Default value = True) + @type hash_hostname: C{bool} """ # IPv4 and IPv6 addresses using the SSH default port need to be stripped off the port number diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py index 89cd7b8..f24cf16 100644 --- a/x2go/backends/control/plain.py +++ b/x2go/backends/control/plain.py @@ -69,7 +69,6 @@ def _rerewrite_blanks(cmd): @param cmd: command that has to be rewritten for log output @type cmd: C{str} - @return: the command with ,,X2GO_SPACE_CHAR'' re-replaced by blanks @rtype: C{str} @@ -90,9 +89,10 @@ def _rewrite_password(cmd, user=None, password=None): @param cmd: command that is to be sent to an X2Go server script @type cmd: C{str} - @param user: the SSH authenticated user name - @type password: the password being used for SSH authentication - + @param user: the SSH authenticated user name (Default value = None) + @type user: C{str} + @param password: the password being used for SSH authentication (Default value = None) + @type password: C{str} @return: the command with macros replaced @rtype: C{str} @@ -115,6 +115,7 @@ class X2GoControlSession(paramiko.SSHClient): The control session handles the SSH based communication between server and client. It is mainly derived from C{paramiko.SSHClient} and adds on X2Go related functionality. + """ def __init__(self, profile_name='UNKNOWN', @@ -240,6 +241,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Get the hostname as stored in the properties of this control session. + @return: the hostname of the connected X2Go server @rtype: C{str} @@ -250,6 +252,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Get the port number of the SSH connection as stored in the properties of this control session. + @return: the server-side port number of the control session's SSH connection @rtype: C{str} @@ -262,6 +265,7 @@ class X2GoControlSession(paramiko.SSHClient): If the file does not exist, create it first. + """ if self.known_hosts is not None: utils.touch_file(self.known_hosts) @@ -282,7 +286,7 @@ class X2GoControlSession(paramiko.SSHClient): raise x2go_exceptions.X2GoSFTPClientException('failed to initialize SFTP channel') def _x2go_sftp_put(self, local_path, remote_path, timeout=20): - """ + """\ Put a local file on the remote server via sFTP. During sFTP operations, remote command execution gets blocked. @@ -291,9 +295,8 @@ class X2GoControlSession(paramiko.SSHClient): @type local_path: C{str} @param remote_path: full remote path name of the server-side target location, path names have to be Unix-compliant @type remote_path: C{str} - @param timeout: this SFTP put action should not take longer then the given value + @param timeout: this SFTP put action should not take longer then the given value (Default value = 20) @type timeout: C{int} - @raise X2GoControlSessionException: if the SSH connection dropped out """ @@ -334,7 +337,7 @@ class X2GoControlSession(paramiko.SSHClient): self._transport_lock.release() def _x2go_sftp_write(self, remote_path, content, timeout=20): - """ + """\ Create a text file on the remote server via sFTP. During sFTP operations, remote command execution gets blocked. @@ -343,9 +346,8 @@ class X2GoControlSession(paramiko.SSHClient): @type remote_path: C{str} @param content: a text file, multi-line files use Unix-link EOL style @type content: C{str} - @param timeout: this SFTP write action should not take longer then the given value + @param timeout: this SFTP write action should not take longer then the given value (Default value = 20) @type timeout: C{int} - @raise X2GoControlSessionException: if the SSH connection dropped out """ @@ -391,16 +393,15 @@ class X2GoControlSession(paramiko.SSHClient): self._transport_lock.release() def _x2go_sftp_remove(self, remote_path, timeout=20): - """ + """\ Remote a remote file from the server via sFTP. During sFTP operations, remote command execution gets blocked. @param remote_path: full remote path name of the server-side file to be removed, path names have to be Unix-compliant @type remote_path: C{str} - @param timeout: this SFTP remove action should not take longer then the given value + @param timeout: this SFTP remove action should not take longer then the given value (Default value = 20) @type timeout: C{int} - @raise X2GoControlSessionException: if the SSH connection dropped out """ @@ -443,24 +444,22 @@ class X2GoControlSession(paramiko.SSHClient): self._transport_lock.release() def _x2go_exec_command(self, cmd_line, loglevel=log.loglevel_INFO, timeout=20, **kwargs): - """ + """\ Execute an X2Go server-side command via SSH. During SSH command executions, sFTP operations get blocked. @param cmd_line: the command to be executed on the remote server @type cmd_line: C{str} or C{list} - @param loglevel: use this loglevel for reporting about remote command execution + @param loglevel: use this loglevel for reporting about remote command execution (Default value = log.loglevel_INFO) @type loglevel: C{int} @param timeout: if commands take longer than C{<timeout>} to be executed, consider the control session connection - to have died. + to have died. (Default value = 20) @type timeout: C{int} @param kwargs: parameters that get passed through to the C{paramiko.SSHClient.exec_command()} method. @type kwargs: C{dict} - @return: C{True} if the command could be successfully executed on the remote X2Go server @rtype: C{bool} - @raise X2GoControlSessionException: if the command execution failed (due to a lost connection) """ @@ -565,6 +564,7 @@ class X2GoControlSession(paramiko.SSHClient): Render a dictionary of server-side X2Go components and their versions. Results get cached once there has been one successful query. + """ if self._server_versions is None: self._server_versions = {} @@ -582,9 +582,8 @@ class X2GoControlSession(paramiko.SSHClient): """\ Do a query for the server-side list of X2Go components and their versions. - @param force: do not use the cached component list, really ask the server (again) + @param force: do not use the cached component list, really ask the server (again) (Default value = False) @type force: C{bool} - @return: dictionary of X2Go components (as keys) and their versions (as values) @rtype: C{list} @@ -599,6 +598,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Render a list of server-side X2Go features. Results get cached once there has been one successful query. + """ if self._server_features is None: (stdin, stdout, stderr) = self._x2go_exec_command('which x2gofeaturelist >/dev/null && x2gofeaturelist') @@ -612,9 +612,8 @@ class X2GoControlSession(paramiko.SSHClient): """\ Do a query for the server-side list of X2Go features. - @param force: do not use the cached feature list, really ask the server (again) + @param force: do not use the cached feature list, really ask the server (again) (Default value = False) @type force: C{bool} - @return: list of X2Go feature names @rtype: C{list} @@ -629,6 +628,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Retrieve and cache the remote home directory location. + """ if self._remote_home is None: (stdin, stdout, stderr) = self._x2go_exec_command('echo $HOME') @@ -646,7 +646,6 @@ class X2GoControlSession(paramiko.SSHClient): @param group: remote POSIX group name @type group: C{str} - @return: list of POSIX group members @rtype: C{list} @@ -667,7 +666,6 @@ class X2GoControlSession(paramiko.SSHClient): @param username: remote user name @type username: C{str} - @return: C{True} if the remote user is allowed to launch X2Go sessions @rtype: C{bool} @@ -684,6 +682,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Check if the remote user is allowed to use SSHFS mounts. + @return: C{True} if the user is allowed to connect client-side shares to the X2Go session @rtype: C{bool} @@ -697,9 +696,9 @@ class X2GoControlSession(paramiko.SSHClient): """\ Returns (and caches) the control session's remote username. + @return: SSH transport's user name @rtype: C{str} - @raise X2GoControlSessionException: on SSH connection loss """ @@ -716,9 +715,9 @@ class X2GoControlSession(paramiko.SSHClient): """\ Returns (and caches) the control session's remote host (name or ip). + @return: SSH transport's peer name @rtype: C{tuple} - @raise X2GoControlSessionException: on SSH connection loss """ @@ -736,6 +735,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Generate (and cache) a temporary RSA host key for the lifetime of this control session. + """ if self._session_auth_rsakey is None: self._session_auth_rsakey = paramiko.RSAKey.generate(defaults.RSAKEY_STRENGTH) @@ -757,9 +757,8 @@ class X2GoControlSession(paramiko.SSHClient): @param hostname: the remote X2Go server's hostname @type hostname: C{str} - @param port: the SSH port of the remote X2Go server + @param port: the SSH port of the remote X2Go server (Default value = 22) @type port: C{int} - @return: C{True} if the host key check succeeded, C{False} otherwise @rtype: C{bool} @@ -809,79 +808,77 @@ class X2GoControlSession(paramiko.SSHClient): @param hostname: the server to connect to @type hostname: C{str} - @param port: the server port to connect to + @param port: the server port to connect to (Default value = 22) @type port: C{int} @param username: the username to authenticate as (defaults to the current local username) @type username: C{str} @param password: a password to use for authentication or for unlocking - a private key + a private key (Default value = None) @type password: C{str} @param passphrase: a passphrase to use for unlocking a private key in case the password is already needed for two-factor - authentication + authentication (Default value = None) @type passphrase: C{str} @param key_filename: the filename, or list of filenames, of optional - private key(s) to try for authentication + private key(s) to try for authentication (Default value = None) @type key_filename: C{str} or list(str) - @param pkey: an optional private key to use for authentication + @param pkey: an optional private key to use for authentication (Default value = None) @type pkey: C{PKey} @param forward_sshagent: forward SSH agent authentication requests to the X2Go client-side - (will update the class property of the same name) + (will update the class property of the same name) (Default value = None) @type forward_sshagent: C{bool} - @param unique_hostkey_aliases: update the unique_hostkey_aliases class property + @param unique_hostkey_aliases: update the unique_hostkey_aliases class property (Default value = None) @type unique_hostkey_aliases: C{bool} - @param timeout: an optional timeout (in seconds) for the TCP connect + @param timeout: an optional timeout (in seconds) for the TCP connect (Default value = None) @type timeout: float @param look_for_keys: set to C{True} to enable searching for discoverable - private key files in C{~/.ssh/} + private key files in C{~/.ssh/} (Default value = False) @type look_for_keys: C{bool} @param allow_agent: set to C{True} to enable connecting to a local SSH agent - for acquiring authentication information + for acquiring authentication information (Default value = False) @type allow_agent: C{bool} @param add_to_known_hosts: non-paramiko option, if C{True} paramiko.AutoAddPolicy() is used as missing-host-key-policy. If set to C{False} paramiko.RejectPolicy() - is used + is used (Default value = None) @type add_to_known_hosts: C{bool} @param force_password_auth: non-paramiko option, disable pub/priv key authentication - completely, even if the C{pkey} or the C{key_filename} parameter is given + completely, even if the C{pkey} or the C{key_filename} parameter is given (Default value = False) @type force_password_auth: C{bool} @param session_instance: an instance L{X2GoSession} using this L{X2GoControlSession} - instance. + instance. (Default value = None) @type session_instance: C{obj} - @param use_sshproxy: connect through an SSH proxy + @param use_sshproxy: connect through an SSH proxy (Default value = False) @type use_sshproxy: C{True} if an SSH proxy is to be used for tunneling the connection - @param sshproxy_host: hostname of the SSH proxy server + @param sshproxy_host: hostname of the SSH proxy server (Default value = None) @type sshproxy_host: C{str} - @param sshproxy_port: port of the SSH proxy server + @param sshproxy_port: port of the SSH proxy server (Default value = 22) @type sshproxy_port: C{int} - @param sshproxy_user: username that we use for authenticating against C{<sshproxy_host>} + @param sshproxy_user: username that we use for authenticating against C{<sshproxy_host>} (Default value = None) @type sshproxy_user: C{str} @param sshproxy_password: a password to use for SSH proxy authentication or for unlocking - a private key + a private key (Default value = None) @type sshproxy_password: C{str} @param sshproxy_passphrase: a passphrase to use for unlocking a private key needed for the SSH proxy host in case the sshproxy_password is already needed for - two-factor authentication + two-factor authentication (Default value = '') @type sshproxy_passphrase: C{str} - @param sshproxy_force_password_auth: enforce using a given C{sshproxy_password} even if a key(file) is given + @param sshproxy_force_password_auth: enforce using a given C{sshproxy_password} even if a key(file) is given (Default value = False) @type sshproxy_force_password_auth: C{bool} - @param sshproxy_key_filename: local file location of the private key file + @param sshproxy_key_filename: local file location of the private key file (Default value = None) @type sshproxy_key_filename: C{str} - @param sshproxy_pkey: an optional private key to use for SSH proxy authentication + @param sshproxy_pkey: an optional private key to use for SSH proxy authentication (Default value = None) @type sshproxy_pkey: C{PKey} @param sshproxy_look_for_keys: set to C{True} to enable connecting to a local SSH agent - for acquiring authentication information (for SSH proxy authentication) + for acquiring authentication information (for SSH proxy authentication) (Default value = False) @type sshproxy_look_for_keys: C{bool} @param sshproxy_allow_agent: set to C{True} to enable connecting to a local SSH agent - for acquiring authentication information (for SSH proxy authentication) + for acquiring authentication information (for SSH proxy authentication) (Default value = False) @type sshproxy_allow_agent: C{bool} - @param sshproxy_tunnel: the SSH proxy tunneling parameters, format is: <local-address>:<local-port>:<remote-address>:<remote-port> + @param sshproxy_tunnel: the SSH proxy tunneling parameters, format is: <local-address>:<local-port>:<remote-address>:<remote-port> (Default value = None) @type sshproxy_tunnel: C{str} - @return: C{True} if an authenticated SSH transport could be retrieved by this method @rtype: C{bool} - @raise BadHostKeyException: if the server's host key could not be verified @raise AuthenticationException: if authentication failed @@ -1190,6 +1187,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Disconnect this control session from the remote server. + @return: report success or failure after having disconnected @rtype: C{bool} @@ -1253,6 +1251,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Test if the remote home directory exists. + @return: C{True} if the home directory exists, C{False} otherwise @rtype: C{bool} @@ -1267,6 +1266,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Test if the connection to the remote X2Go server is still alive. + @return: C{True} if the connection is still alive, C{False} otherwise @rtype: C{bool} @@ -1283,6 +1283,7 @@ class X2GoControlSession(paramiko.SSHClient): """\ Test if the connection to the remote X2Go server died on the way. + @return: C{True} if the connection has died, C{False} otherwise @rtype: C{bool} @@ -1299,15 +1300,17 @@ class X2GoControlSession(paramiko.SSHClient): The {very_raw} lets this method return the output of the C{x2gogetapps} script as is. - @param lang: locale/language identifier + @param lang: locale/language identifier (Default value = None) @type lang: C{str} - @param refresh: force reload of the menu tree from X2Go server + @param refresh: force reload of the menu tree from X2Go server (Default value = False) @type refresh: C{bool} - @param raw: retrieve a raw output of the server list of published applications + @param raw: retrieve a raw output of the server list of published applications (Default value = False) @type raw: C{bool} - @param very_raw: retrieve a very raw output of the server list of published applications + @param very_raw: retrieve a very raw output of the server list of published applications (Default value = False) @type very_raw: C{bool} - + @param max_no_submenus: Number of applications before applications are put into XDG category submenus + (Default value = defaults.PUBAPP_MAX_NO_SUBMENUS) + @type max_no_submenus: C{int} @return: an i18n capable menu tree packed as a Python dictionary @rtype: C{list} @@ -1497,7 +1500,6 @@ class X2GoControlSession(paramiko.SSHClient): L{resume()} method, only the C{session_name} parameter will get removed before pass-through @type kwargs: C{dict} - @return: return value of the cascaded L{resume()} method, denoting the success or failure of the session startup @rtype: C{bool} @@ -1514,9 +1516,15 @@ class X2GoControlSession(paramiko.SSHClient): The L{X2GoControlSession.resume()} method accepts any parameter that can be passed to any of the C{X2GoTerminalSession*} backend class constructors. + @param session_name: the X2Go session name (Default value = None) + @type session_name: C{str} + @param session_instance: a Python X2Go session instance (Default value = None) + @type session_instance: L{X2GoSession} + @param session_list: (Default value = None) + @param kwargs: catch any non-defined param in kwargs + @type kwargs: C{dict} @return: True if the session could be successfully resumed @rtype: C{bool} - @raise X2GoUserException: if the remote user is not allowed to launch/resume X2Go sessions. """ @@ -1575,20 +1583,19 @@ class X2GoControlSession(paramiko.SSHClient): Share another already running desktop session. Desktop sharing can be run in two different modes: view-only and full-access mode. - @param desktop: desktop ID of a sharable desktop in format C{<user>@<display>} + @param desktop: desktop ID of a sharable desktop in format C{<user>@<display>} (Default value = None) @type desktop: C{str} @param user: user name and display number can be given separately, here give the - name of the user who wants to share a session with you + name of the user who wants to share a session with you (Default value = None) @type user: C{str} @param display: user name and display number can be given separately, here give the - number of the display that a user allows you to be shared with + number of the display that a user allows you to be shared with (Default value = None) @type display: C{str} - @param share_mode: desktop sharing mode, 0 stands for VIEW-ONLY, 1 for FULL-ACCESS mode + @param share_mode: desktop sharing mode, 0 stands for VIEW-ONLY, 1 for FULL-ACCESS mode (Default value = 0) @type share_mode: C{int} - + @param **kwargs: @return: True if the session could be successfully shared @rtype: C{bool} - @raise X2GoDesktopSharingException: if C{username} and C{dislpay} do not relate to a sharable desktop session @@ -1612,12 +1619,12 @@ class X2GoControlSession(paramiko.SSHClient): granted desktop sharing) on the connected server. @param raw: if C{True}, the raw output of the server-side X2Go command - C{x2golistdesktops} is returned. + C{x2golistdesktops} is returned. (Default value = False) @type raw: C{bool} - + @param maxwait: time in secs to wait for server query to reply (Default value = 20) + @type maxwait: C{int} @return: a list of X2Go desktops available for sharing @rtype: C{list} - @raise X2GoTimeOutException: on command execution timeouts, with the server-side C{x2golistdesktops} command this can sometimes happen. Make sure you ignore these time-outs and to try again @@ -1657,14 +1664,12 @@ class X2GoControlSession(paramiko.SSHClient): @param session_name: name of a session to query a list of mounts for @type session_name: C{str} @param raw: if C{True}, the raw output of the server-side X2Go command - C{x2golistmounts} is returned. + C{x2golistmounts} is returned. (Default value = False) @type raw: C{bool} - @param maxwait: stop processing C{x2golistmounts} after C{<maxwait>} seconds + @param maxwait: stop processing C{x2golistmounts} after C{<maxwait>} seconds (Default value = 20) @type maxwait: C{int} - @return: a list of client-side mounts for X2Go session C{<session_name>} on the server @rtype: C{list} - @raise X2GoTimeOutException: on command execution timeouts, queries with the server-side C{x2golistmounts} query should normally be processed quickly, a time-out may hint that the control session has lost its connection to the X2Go server @@ -1701,16 +1706,15 @@ class X2GoControlSession(paramiko.SSHClient): List all sessions of current user on the connected server. @param raw: if C{True}, the raw output of the server-side X2Go command - C{x2golistsessions} is returned. + C{x2golistsessions} is returned. (Default value = False) @type raw: C{bool} - @return: normally an instance of a C{X2GoServerSessionList*} backend is returned. However, if the raw argument is set, the plain text output of the server-side C{x2golistsessions} command is returned @rtype: C{X2GoServerSessionList} instance or str - @raise X2GoControlSessionException: on command execution timeouts, if this happens the control session will be interpreted as disconnected due to connection loss + """ if raw: if 'X2GO_LIST_SHADOWSESSIONS' in self._x2go_server_features: @@ -1776,9 +1780,9 @@ class X2GoControlSession(paramiko.SSHClient): Find X2Go terminals that have previously been started by the connected user on the remote X2Go server and terminate them. - @param destroy_terminals: destroy the terminal session instances after cleanup + @param destroy_terminals: destroy the terminal session instances after cleanup (Default value = True) @type destroy_terminals: C{bool} - @param published_applications: also clean up published applications providing sessions + @param published_applications: also clean up published applications providing sessions (Default value = False) @type published_applications: C{bool} """ @@ -1803,6 +1807,7 @@ class X2GoControlSession(paramiko.SSHClient): Returns C{True} if this control session is connected to the remote server (that is: if it has a valid Paramiko/SSH transport object). + @return: X2Go session connected? @rtype: C{bool} @@ -1816,7 +1821,6 @@ class X2GoControlSession(paramiko.SSHClient): @param session_name: X2Go name of the session to be queried @type session_name: C{str} - @return: X2Go session running? If C{<session_name>} is not listable by the L{list_sessions()} method then C{None} is returned @rtype: C{bool} or C{None} @@ -1831,6 +1835,8 @@ class X2GoControlSession(paramiko.SSHClient): Returns C{True} if the given X2Go session is in suspended state, C{False} else. + @param session_name: X2Go name of the session to be queried + @type session_name: C{str} @return: X2Go session suspended? If C{<session_name>} is not listable by the L{list_sessions()} method then C{None} is returned @rtype: C{bool} or C{None} @@ -1847,6 +1853,8 @@ class X2GoControlSession(paramiko.SSHClient): If C{<session_name>} has not been seen, yet, the method will return C{None}. + @param session_name: X2Go name of the session to be queried + @type session_name: C{str} @return: X2Go session has terminated? @rtype: C{bool} or C{None} @@ -1870,7 +1878,6 @@ class X2GoControlSession(paramiko.SSHClient): @param session_name: X2Go name of the session to be suspended @type session_name: C{str} - @return: C{True} if the session could be successfully suspended @rtype: C{bool} @@ -1907,7 +1914,8 @@ class X2GoControlSession(paramiko.SSHClient): @param session_name: X2Go name of the session to be terminated @type session_name: C{str} - + @param destroy_terminals: destroy all terminal sessions associated to this control session (Default value = True) + @type destroy_terminals: C{bool} @return: C{True} if the session could be successfully terminated @rtype: C{bool} diff --git a/x2go/backends/info/plain.py b/x2go/backends/info/plain.py index 36d5576..2d02596 100644 --- a/x2go/backends/info/plain.py +++ b/x2go/backends/info/plain.py @@ -44,6 +44,7 @@ class X2GoServerSessionInfo(object): that is retrieved from the connected X2Go server on C{X2GoTerminalSession.start()} resp. C{X2GoTerminalSession.resume()}. + """ def __str__(self): return self.name @@ -100,6 +101,7 @@ class X2GoServerSessionInfo(object): """\ Detect from session info if this session is a published applications provider. + @return: returns C{True} if this session is a published applications provider @rtype: C{bool} @@ -110,6 +112,7 @@ class X2GoServerSessionInfo(object): """\ Is this session running? + @return: C{True} if the session is running, C{False} otherwise @rtype: C{bool} @@ -120,8 +123,10 @@ class X2GoServerSessionInfo(object): """\ Get the session type (i.e. 'D', 'R', 'S' or 'P'). + @return: session type @rtype: C{str} + """ cmd = self.name.split('_')[1] print(cmd) @@ -134,6 +139,7 @@ class X2GoServerSessionInfo(object): """\ Get the share mode of a shadow session. + @return: share mode (0: view-only, 1: full access), C{None} when used for non-desktop-sharing sessions @rtype: C{str} @@ -149,6 +155,7 @@ class X2GoServerSessionInfo(object): """\ Is this session suspended? + @return: C{True} if the session is suspended, C{False} otherwise @rtype: C{bool} @@ -159,6 +166,7 @@ class X2GoServerSessionInfo(object): """\ Is this session a desktop session? + @return: C{True} if this session is a desktop session, C{False} otherwise @rtype: C{bool} @@ -215,13 +223,13 @@ class X2GoServerSessionInfo(object): @param x2go_output: X2Go server's C{x2gostartagent} command output, each value separated by a newline character. @type x2go_output: str - @param username: session user name + @param username: session user name (Default value = '') @type username: str - @param hostname: hostname of X2Go server + @param hostname: hostname of X2Go server (Default value = '') @type hostname: str - @param local_container: X2Go client session directory for config files, cache and session logs + @param local_container: X2Go client session directory for config files, cache and session logs (Default value = '') @type local_container: str - @param remote_container: X2Go server session directory for config files, cache and session logs + @param remote_container: X2Go server session directory for config files, cache and session logs (Default value = '') @type remote_container: str """ @@ -236,6 +244,7 @@ class X2GoServerSessionInfo(object): """\ Write-protect this session info data structure. + """ self.protected = True @@ -243,11 +252,13 @@ class X2GoServerSessionInfo(object): """\ Remove write-protection from this session info data structure. + """ self.protected = False def is_protected(self): """\ + Check if this session info data structure is Write-protected. """ return self.protected @@ -256,6 +267,7 @@ class X2GoServerSessionInfo(object): """\ Retrieve the session's status from this session info data structure. + @return: session status @rtype: C{str} @@ -266,6 +278,7 @@ class X2GoServerSessionInfo(object): """\ Clear all properties of a L{X2GoServerSessionInfo} object. + """ self.name = '' self.cookie = '' @@ -315,6 +328,7 @@ class X2GoServerSessionList(object): that is retrieved from a connected X2Go server on a C{X2GoControlSession.list_sessions()} call. + """ def __init__(self, x2go_output=None, info_backend=X2GoServerSessionInfo): """\ @@ -343,6 +357,9 @@ class X2GoServerSessionList(object): """\ Set the sessions property directly by parsing a complete data structure. + @param sessions: set this instance's list of sessions directly + @type sessions: C{dict} + """ self.sessions = sessions @@ -352,7 +369,6 @@ class X2GoServerSessionList(object): @param session_name: the queried session name @type session_name: C{str} - @return: the session info of C{<session_name>} @rtype: C{X2GoServerSessionInfo*} or C{None} @@ -370,7 +386,7 @@ class X2GoServerSessionList(object): @type property_name: C{str} @param value: the resulting session has to match this value for C{<property_name>} @type value: C{str} - @param hostname: the result has to match this hostname + @param hostname: the result has to match this hostname (Default value = None) @type hostname: C{str} """ diff --git a/x2go/backends/printing/file.py b/x2go/backends/printing/file.py index 2b17f64..4df2c88 100644 --- a/x2go/backends/printing/file.py +++ b/x2go/backends/printing/file.py @@ -75,6 +75,7 @@ class X2GoClientPrinting(inifiles.X2GoIniFile): Thus, changes on the file are active for the next incoming print job. + """ config_files = [] _print_action = None @@ -105,6 +106,7 @@ class X2GoClientPrinting(inifiles.X2GoIniFile): Derive a print action from sections, keys and their values in a typical X2Go client »printing« configuration file. + """ _general_pdfview = self.get('General', 'pdfview', key_type=bool) _view_open = self.get('view', 'open', key_type=bool) @@ -136,7 +138,9 @@ class X2GoClientPrinting(inifiles.X2GoIniFile): Return the print action described by the »printing« configuration file. This method has property status and wraps around the L{get_print_action} - method. + + @return: Returns the print action object + @rtype: C{obj} or C{str} """ return self.get_print_action() @@ -145,13 +149,12 @@ class X2GoClientPrinting(inifiles.X2GoIniFile): """\ Return the print action described by the »printing« configuration file. - @param reload: reload the configuration file before retrieving the print action? + @param reload: reload the configuration file before retrieving the print action? (Default value = False) @type reload: C{bool} - @param reinit: re-detect the print action from what is stored in cache? + @param reinit: re-detect the print action from what is stored in cache? (Default value = False) @type reinit: C{bool} - @param return_name: return the print action name, not the class + @param return_name: return the print action name, not the class (Default value = False) @type return_name: C{bool} - @return: the configured print action @rtype: C{obj} or C{str} @@ -173,10 +176,8 @@ class X2GoClientPrinting(inifiles.X2GoIniFile): @param print_property: a printing property @type print_property: C{str} - @return: the stored value for C{<print_property>} @rtype: C{str} - @raise X2GoClientPrintingException: if the printing property does not exist """ @@ -194,8 +195,7 @@ class X2GoClientPrinting(inifiles.X2GoIniFile): @param print_property: a printing property @type print_property: C{str} @param value: the value to be stored as C{<print_property>} - @rtype: C{str} - + @type value: C{str} @raise X2GoClientPrintingException: if the printing property does not exist or if there is a type mismatch """ diff --git a/x2go/backends/printing/winreg.py b/x2go/backends/printing/winreg.py index 6702e57..0dde572 100644 --- a/x2go/backends/printing/winreg.py +++ b/x2go/backends/printing/winreg.py @@ -53,6 +53,7 @@ class X2GoClientPrinting(object): Thus, changes on the file are active for the next incoming print job. + """ _print_action = None defaultValues = copy.deepcopy(_X2GO_CLIENTPRINTING_DEFAULTS) diff --git a/x2go/backends/profiles/base.py b/x2go/backends/profiles/base.py index 8d90c77..50453b2 100644 --- a/x2go/backends/profiles/base.py +++ b/x2go/backends/profiles/base.py @@ -116,6 +116,9 @@ class X2GoSessionProfiles(object): Inherit from this class to (re-)initialize profile ID based cache storage. + @param profile_id: profile ID + @type profile_id: C{str} + """ pass @@ -124,6 +127,7 @@ class X2GoSessionProfiles(object): Load a session profile set from the configuration storage backend and make it available for this class. + @return: a set of session profiles @rtype: C{dict} @@ -153,6 +157,7 @@ class X2GoSessionProfiles(object): Inherit from this class and provide the backend specific way of loading / populating a set of session profile via this method. + @return: a set of session profiles @rtype: C{dict} @@ -165,9 +170,8 @@ class X2GoSessionProfiles(object): @param profile_id_or_name: profile ID or profile name @type profile_id_or_name: C{str} - @param force: re-detect the meta type, otherwise use a cached result + @param force: re-detect the meta type, otherwise use a cached result (Default value = False) @type force: C{bool} - @return: the profile ID's / name's meta type @rtype: C{str} @@ -207,15 +211,13 @@ class X2GoSessionProfiles(object): """\ Check if a given profile name (or ID) is mutable or not. - @param profile_id_or_name: profile name or profile ID + @param profile_id_or_name: profile name or profile ID (Default value = None) @type profile_id_or_name: C{str} @param profile_id: if the profile ID is known, pass it in directly and skip - the L{check_profile_id_or_name()} call + the L{check_profile_id_or_name()} call (Default value = None) @type profile_id: C{str} - @return: C{True} if the session profile of the specified name/ID is mutable @rtype: C{bool} - @raise X2GoProfileException: if no such session profile exists """ @@ -232,7 +234,6 @@ class X2GoSessionProfiles(object): @param profile_id: profile ID @type profile_id: C{str} - @return: C{True} if the session profile of the specified ID is mutable @rtype: C{bool} @@ -244,6 +245,7 @@ class X2GoSessionProfiles(object): Check if the current session profile backend supports mutable session profiles. + @return: list of mutable profiles @rtype: C{list} @@ -256,6 +258,7 @@ class X2GoSessionProfiles(object): code here if a your session profile backend supports mutable session profiles or not. + @return: list of mutable profiles @rtype: C{list} @@ -266,6 +269,7 @@ class X2GoSessionProfiles(object): """\ List all mutable session profiles. + @return: List up all session profile IDs of mutable session profiles. @rtype: C{bool} @@ -276,6 +280,7 @@ class X2GoSessionProfiles(object): """\ Store session profile data to the storage backend. + @return: C{True} if the write process has been successfull, C{False} otherwise @rtype: C{bool} @@ -300,6 +305,7 @@ class X2GoSessionProfiles(object): Write session profiles back to session profile storage backend. Inherit from this class and adapt to the session profile backend via this method. + """ return True @@ -309,7 +315,6 @@ class X2GoSessionProfiles(object): @param option: the option to get the data type for @type option: will be detected by this method - @return: the data type of C{option} @rtype: C{type} @@ -323,13 +328,12 @@ class X2GoSessionProfiles(object): """\ The configuration options for a single session profile. - @param profile_id_or_name: either profile ID or profile name is accepted + @param profile_id_or_name: either profile ID or profile name is accepted (Default value = None) @type profile_id_or_name: C{str} - @param parameter: if specified, only the value for the given parameter is returned + @param parameter: if specified, only the value for the given parameter is returned (Default value = None) @type parameter: C{str} - @param profile_id: profile ID (faster than specifying C{profile_id_or_name}) + @param profile_id: profile ID (faster than specifying C{profile_id_or_name}) (Default value = None) @type profile_id: C{str} - @return: the session profile configuration for the given profile ID (or name) @rtype: C{dict} @@ -374,6 +378,7 @@ class X2GoSessionProfiles(object): """\ Return a default session profile. + @return: default session profile @rtype: C{dict} @@ -386,7 +391,6 @@ class X2GoSessionProfiles(object): @param profile_id_or_name: profile ID or profile name @type profile_id_or_name: C{str} - @return: C{True} if there is such a session profile, C{False} otherwise @rtype: C{bool} @@ -407,6 +411,7 @@ class X2GoSessionProfiles(object): """\ Render a list of all profile IDs found in the session profiles configuration. + """ if not self._cached_profile_ids: self._update_profile_ids_cache() @@ -417,6 +422,7 @@ class X2GoSessionProfiles(object): Inherit from this class and provide a way for actually getting a list of session profile IDs from the storage backend via this method. + @return: list of available session profile IDs @rtype: C{list} @@ -429,7 +435,6 @@ class X2GoSessionProfiles(object): @param profile_id: profile ID @type profile_id: C{str} - @return: C{True} if there is such a session profile, C{False} otherwise @rtype: C{bool} @@ -441,6 +446,7 @@ class X2GoSessionProfiles(object): """\ Render a list of all profile names found in the session profiles configuration. + """ if not self._cached_profile_ids: self._update_profile_ids_cache() @@ -452,7 +458,6 @@ class X2GoSessionProfiles(object): @param profile_name: profile name @type profile_name: C{str} - @return: C{True} if there is such a session profile, C{False} otherwise @rtype: C{bool} @@ -465,7 +470,6 @@ class X2GoSessionProfiles(object): @param profile_name: profile name @type profile_name: C{str} - @return: profile ID @rtype: C{str} @@ -484,7 +488,6 @@ class X2GoSessionProfiles(object): @param profile_id: profile ID @type profile_id: C{str} - @return: profile name @rtype: C{str} @@ -499,11 +502,12 @@ class X2GoSessionProfiles(object): """\ Add a new session profile. - @param profile_id: a custom profile ID--if left empty a profile ID will be auto-generated + @param profile_id: a custom profile ID--if left empty a profile ID will be auto-generated (Default value = None) @type profile_id: C{str} @param kwargs: session profile options for this new session profile @type kwargs: C{dict} - + @param force_add: enforce adding of the given profile (Default value = False) + @type force_add: C{bool} @return: the (auto-generated) profile ID of the new session profile @rtype: C{str} @@ -553,6 +557,9 @@ class X2GoSessionProfiles(object): Inherit from this class and provide a way for actually deleting a complete session profile from the storage backend via this method. + @param profile_id: Profile ID of the profile to be deleted + @type profile_id: C{str} + """ pass @@ -567,7 +574,7 @@ class X2GoSessionProfiles(object): @param value: the value to update the session profile option with @type value: any type, depends on the session profile option @param profile_id: if the profile ID is known, pass it in directly and skip - the L{check_profile_id_or_name()} call + the L{check_profile_id_or_name()} call (Default value = None) @type profile_id: C{str} """ @@ -616,6 +623,13 @@ class X2GoSessionProfiles(object): Inherit from this class and provide for actually updating a session profile's value in the storage backend via this method. + @param profile_id: the profile ID of the profile to be updated + @type profile_id: C{str} + @param option: the option to be updated + @type option: C{str} + @param value: the value to be updated for the given option + @type value: C{str} or C{list} or C{int} or C{bool} + """ pass @@ -625,10 +639,8 @@ class X2GoSessionProfiles(object): @param profile_id_or_name: profile ID or profile name @type profile_id_or_name: C{str} - @return: profile ID @rtype: C{str} - @raise X2GoProfileException: if no such session profile exists """ @@ -649,11 +661,10 @@ class X2GoSessionProfiles(object): """\ Convert session profile options to L{X2GoSession} constructor method parameters. - @param profile_id_or_name: either profile ID or profile name is accepted + @param profile_id_or_name: either profile ID or profile name is accepted (Default value = None) @type profile_id_or_name: C{str} - @param profile_id: profile ID (fast than specifying C{profile_id_or_name}) + @param profile_id: profile ID (fast than specifying C{profile_id_or_name}) (Default value = None) @type profile_id: C{str} - @return: a dictionary of L{X2GoSession} constructor method parameters @rtype: C{dict} @@ -669,7 +680,6 @@ class X2GoSessionProfiles(object): @type profile_id_or_name: C{str} @param param: the parameter name in the L{X2GoSession} constructor method @type param: C{str} - @return: the value of the session profile option represented by C{param} @rtype: depends on the session profile option requested @@ -687,7 +697,6 @@ class X2GoSessionProfiles(object): @type option: C{str} @param key_type: type of the value to return @type key_type: C{typeobject} - @return: value of a session profile parameter @rtype: C{various types} @@ -699,6 +708,8 @@ class X2GoSessionProfiles(object): Inherit from this class and provide a way for actually obtaining a list of available profile options of a given session profile. + @param profile_id: the profile ID of the profile to operate on + @type profile_id: C{str} @return: list of available option is the given session profile @rtype: C{list} @@ -711,7 +722,6 @@ class X2GoSessionProfiles(object): @param profile_id: the profile's unique ID @type profile_id: C{str} - @return: the host name of the X2Go Server configured by the session profile of the given profile ID @rtype: C{list} @@ -726,7 +736,6 @@ class X2GoSessionProfiles(object): @param profile_id: the profile's unique ID @type profile_id: C{str} - @return: the host name of the X2Go Server configured by the session profile of the given profile ID @rtype: C{list} @@ -740,7 +749,6 @@ class X2GoSessionProfiles(object): @param profile_id: the profile's unique ID @type profile_id: C{str} - @return: the SSH port of the X2Go Server configured by the session profile of the given profile ID @rtype: C{list} @@ -755,7 +763,6 @@ class X2GoSessionProfiles(object): @param profile_id: the profile's unique ID @type profile_id: C{str} - @return: the SSH port of the X2Go Server configured by the session profile of the given profile ID @rtype: C{list} @@ -769,7 +776,6 @@ class X2GoSessionProfiles(object): @param profile_id: the profile's unique ID @type profile_id: C{str} - @return: a Paramiko/SSH PKey object @rtype: C{obj} @@ -781,5 +787,8 @@ class X2GoSessionProfiles(object): Inherit from this class and provide a way for actually providing such a PKey object. + @param profile_id: the profile ID for which to retrieve the PKey object + @type profile_id: C{str} + """ return None diff --git a/x2go/backends/profiles/file.py b/x2go/backends/profiles/file.py index ffadff5..5c42389 100644 --- a/x2go/backends/profiles/file.py +++ b/x2go/backends/profiles/file.py @@ -40,21 +40,21 @@ import x2go.log as log class X2GoSessionProfiles(base.X2GoSessionProfiles, inifiles.X2GoIniFile): def __init__(self, config_files=_X2GO_SESSIONPROFILES_CONFIGFILES, session_profile_defaults=None, logger=None, loglevel=log.loglevel_DEFAULT, **kwargs): - """\ + """\ Retrieve X2Go session profiles from a file, typically C{~/.x2goclient/sessions}. - @param config_files: a list of config file locations, the first file name in this list the user has write access to will be the user configuration file - @type config_files: C{list} - @param session_profile_defaults: a default session profile - @type session_profile_defaults: C{dict} - @param logger: you can pass an L{X2GoLogger} object to the + @param config_files: a list of config file locations, the first file name in this list the user has write access to will be the user configuration file + @type config_files: C{list} + @param session_profile_defaults: a default session profile + @type session_profile_defaults: C{dict} + @param logger: you can pass an L{X2GoLogger} object to the L{x2go.backends.profiles.file.X2GoSessionProfiles} constructor - @type logger: L{X2GoLogger} instance - @param loglevel: if no L{X2GoLogger} object has been supplied a new one will be + @type logger: L{X2GoLogger} instance + @param loglevel: if no L{X2GoLogger} object has been supplied a new one will be constructed with the given loglevel - @type loglevel: C{int} + @type loglevel: C{int} - """ + """ # providing defaults for an X2GoSessionProfiles instance will---in the worst case---override your # existing sessions file in your home directory once you write the sessions back to file... inifiles.X2GoIniFile.__init__(self, config_files=config_files, logger=logger, loglevel=loglevel) @@ -69,7 +69,6 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles, inifiles.X2GoIniFile): @type section: C{str} @param key: key in INI file section @type key: C{str} - @return: the data type of C{key} in C{section} @rtype: C{type} @@ -82,6 +81,7 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles, inifiles.X2GoIniFile): Populate the set of session profiles by loading the session profile configuration from a file in INI format. + @return: a set of session profiles @rtype: C{dict} diff --git a/x2go/backends/profiles/httpbroker.py b/x2go/backends/profiles/httpbroker.py index f9a1cc7..77b09bf 100644 --- a/x2go/backends/profiles/httpbroker.py +++ b/x2go/backends/profiles/httpbroker.py @@ -123,7 +123,9 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): """\ Accessor for the class's C{broker_noauth} property. + @return: C{True} if the broker probably does not expect authentication. + @rtype: C{bool} """ @@ -133,7 +135,9 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): """\ Accessor for the class's C{broker_username} property. + @return: the username used for authentication against the session broker URL + @rtype: C{str} """ @@ -143,7 +147,9 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): """\ Accessor for the class's C{broker_url} property. + @return: the session broker URL that was used at broker session instantiation + @rtype: C{str} """ @@ -157,7 +163,6 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): C{<protocol>://<hostname>:<port>/<path>} (where protocol has to be C{http} or C{https}. @type broker_url: C{str} - @return: the session broker URL that was used at broker session instantiation @rtype: C{str} @@ -168,7 +173,9 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): """\ Accessor of the class's {_broker_type} property. + @return: either C{http} or C{https}. + @rtype: C{str} """ @@ -183,10 +190,8 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): @type broker_username: C{str} @param broker_password: password to use for authentication @type broker_password: C{str} - @return: C{True} if authentication has been successful @rtype: C{bool} - @raise X2GoBrokerConnectionException: Raised on any kind of connection / authentication failure. @@ -232,6 +237,7 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): this instance has to re-authenticate against / re-connect to the session broker before any new interaction with the broker is possible. + """ _profile_ids = copy.deepcopy(self.profile_ids) @@ -258,8 +264,10 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): will be attempted. If that fails, user credentials are not provided / valid. + @return: C{True} if the broker session has already been authenticated and user credentials are known / valid + @rtype: C{bool} """ @@ -275,7 +283,9 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): """\ Obtain a session profile list from the X2Go Session Broker. + @return: session profiles as a Python dictionary. + @rtype: C{dict} """ @@ -319,7 +329,6 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): @param profile_id: profile ID of the selected session profile @type profile_id: C{str} - @return: session information (server, port, SSH keys, etc.) for a selected session profile (i.e. C{profile_id}) @rtype: C{dict} @@ -369,7 +378,9 @@ class X2GoSessionProfiles(base.X2GoSessionProfiles): Populate the set of session profiles by loading the session profile configuration from a file in INI format. + @return: a set of session profiles + @rtype: C{dict} """ diff --git a/x2go/backends/proxy/base.py b/x2go/backends/proxy/base.py index ca815a8..0dbcbb2 100644 --- a/x2go/backends/proxy/base.py +++ b/x2go/backends/proxy/base.py @@ -58,6 +58,7 @@ class X2GoProxy(threading.Thread): This class needs to be inherited from a concrete proxy class. Only currently available proxy class is: L{x2go.backends.proxy.nx3.X2GoProxy}. + """ PROXY_CMD = '' """Proxy command. Needs to be set by a potential child class, might be OS specific.""" @@ -134,6 +135,7 @@ class X2GoProxy(threading.Thread): Close any left open port forwarding tunnel, also close session log file, if left open. + """ if self.proxy: self.logger('Shutting down X2Go proxy subprocess', loglevel=log.loglevel_DEBUG) @@ -155,6 +157,7 @@ class X2GoProxy(threading.Thread): """\ End the thread runner and tidy up. + """ self._keepalive = False # wait for thread loop to finish... @@ -167,6 +170,7 @@ class X2GoProxy(threading.Thread): Paramiko/SSH based forwarding tunnel (openssh -L option). This tunnel gets started here and is forked into background (Greenlet/gevent). + """ self._keepalive = True self.proxy = None @@ -257,6 +261,7 @@ class X2GoProxy(threading.Thread): 2. once you have finished processing the proxy_options call the parent class method L{x2go.backends.proxy.base.X2GoProxy.process_proxy_options()} + """ # do the logging of remaining options if self.proxy_options: @@ -272,7 +277,9 @@ class X2GoProxy(threading.Thread): """\ Start the thread runner and wait for the proxy to come up. + @return: a subprocess instance that knows about the externally started proxy command. + @rtype: C{obj} """ @@ -302,8 +309,10 @@ class X2GoProxy(threading.Thread): """\ Check if a proxy instance is up and running. + @return: Proxy state, C{True} for proxy being up-and-running, C{False} otherwise - @rtype C{bool} + + @rtype: C{bool} """ return bool(self.proxy and self.proxy.poll() is None) and self.fw_tunnel.is_active diff --git a/x2go/backends/proxy/nx3.py b/x2go/backends/proxy/nx3.py index b531824..a514e48 100644 --- a/x2go/backends/proxy/nx3.py +++ b/x2go/backends/proxy/nx3.py @@ -42,6 +42,7 @@ class X2GoProxy(base.X2GoProxy): It basically fills L{x2go.backends.proxy.base.X2GoProxy} variables with sensible content. Its methods mostly wrap around the corresponding methods of the parent class. + """ def __init__(self, *args, **kwargs): """\ @@ -114,6 +115,7 @@ class X2GoProxy(base.X2GoProxy): """\ Generate the NX proxy command line for execution. + """ if _X2GOCLIENT_OS == "Windows": _options_filename = os.path.join(self.session_info.local_container, 'options') @@ -135,7 +137,9 @@ class X2GoProxy(base.X2GoProxy): """\ Start the thread runner and wait for the proxy to come up. + @return: a subprocess instance that knows about the externally started proxy command. + @rtype: C{obj} """ diff --git a/x2go/backends/settings/file.py b/x2go/backends/settings/file.py index a83018b..1ed6753 100644 --- a/x2go/backends/settings/file.py +++ b/x2go/backends/settings/file.py @@ -42,6 +42,7 @@ class X2GoClientSettings(inifiles.X2GoIniFile): """\ Configuration file based settings for L{X2GoClient} instances. + """ def __init__(self, config_files=_X2GO_SETTINGS_CONFIGFILES, defaults=_X2GO_CLIENTSETTINGS_DEFAULTS, logger=None, loglevel=log.loglevel_DEFAULT): """\ diff --git a/x2go/backends/settings/winreg.py b/x2go/backends/settings/winreg.py index 3ba4410..3eb6b77 100644 --- a/x2go/backends/settings/winreg.py +++ b/x2go/backends/settings/winreg.py @@ -45,6 +45,7 @@ class X2GoClientSettings(inifiles.X2GoIniFile): """\ Windows registry based settings for L{X2GoClient} instances. + """ defaultValues = copy.deepcopy(_X2GO_CLIENTSETTINGS_DEFAULTS) diff --git a/x2go/backends/terminal/plain.py b/x2go/backends/terminal/plain.py index 16e0e82..cf0c37f 100644 --- a/x2go/backends/terminal/plain.py +++ b/x2go/backends/terminal/plain.py @@ -72,9 +72,8 @@ def _rewrite_cmd(cmd, params=None): @param cmd: the current command for execution (as found in the session profile parameter C{cmd}) @type cmd: C{str} - @param params: an session paramter object + @param params: an session paramter object (Default value = None) @type params: L{X2GoSessionParams} - @return: the rewritten command for server-side execution @rtype: C{str} @@ -111,7 +110,6 @@ def _rewrite_blanks(cmd): @param cmd: command that has to be rewritten for passing to the server @type cmd: C{str} - @return: the command with blanks rewritten to ,,X2GO_SPACE_CHAR'' @rtype: C{str} @@ -127,6 +125,7 @@ class X2GoSessionParams(object): The L{X2GoSessionParams} class is used to store all parameters that C{X2GoTerminalSession} backend objects are constructed with. + """ def rewrite_session_type(self): """\ @@ -137,9 +136,11 @@ class X2GoSessionParams(object): manager, the session type will be set to 'D' (i.e. desktop). - @return: 'D' if session should probably a desktop session, + + @return: D' if session should probably a desktop session, 'R' for rootless sessions, 'P' for sessions providing published applications, and 'S' for desktop sharing sessions + @rtype: C{str} """ @@ -207,6 +208,7 @@ class X2GoTerminalSession(object): session instance (e.g. L{x2go.backends.control.plain.X2GoControlSession}). You never should use either of them as a standalone instance. Both, control session and terminal session(s) get managed/controlled via L{X2GoSession} instances. + """ def __init__(self, control_session, session_info=None, geometry="800x600", depth=_local_color_depth, link="adsl", pack="16m-jpeg-9", dpi='', @@ -300,7 +302,7 @@ class X2GoTerminalSession(object): @type print_action: C{str} or C{class} @param print_action_args: optional arguments for a given print_action (for further info refer to L{X2GoPrintActionPDFVIEW}, L{X2GoPrintActionPDFSAVE}, L{X2GoPrintActionPRINT} and L{X2GoPrintActionPRINTCMD}) - @type print_action_args: dict + @type print_action_args: C{dict} @param info_backend: backend for handling storage of server session information @type info_backend: C{X2GoServerSessionInfo*} instance @param list_backend: backend for handling storage of session list information @@ -426,6 +428,7 @@ class X2GoTerminalSession(object): - shutdown the MIME box queue (if running) - clear the session info + """ if self._share_local_folder_lock.locked(): self._share_local_folder_lock.release() @@ -476,6 +479,7 @@ class X2GoTerminalSession(object): """\ Purge client-side session dir (session cache directory). + """ if self.session_info.name: shutil.rmtree('%s/S-%s' % (self.params.rootdir, self.session_info), ignore_errors=True) @@ -484,6 +488,7 @@ class X2GoTerminalSession(object): """\ Purge client-side session dir (C-<display> directory) + """ if self.session_info.display: shutil.rmtree('%s/S-%s' % (self.params.rootdir, self.session_info.display), ignore_errors=True) @@ -492,7 +497,9 @@ class X2GoTerminalSession(object): """\ Retrieve the X2Go session's name from the session info object. + @return: the session name + @rtype: C{str} """ @@ -502,7 +509,9 @@ class X2GoTerminalSession(object): """\ Retrieve the X2Go session's session info object. + @return: the session info object + @rtype: C{X2GoServerSessionInfo*} """ @@ -512,7 +521,9 @@ class X2GoTerminalSession(object): """\ Retrieve the X2Go session's command as stored in the session parameter object. + @return: the session command + @rtype: C{str} """ @@ -522,7 +533,9 @@ class X2GoTerminalSession(object): """\ Retrieve the X2Go session's session type as stored in the session parameter object. + @return: the session type + @rtype: C{str} """ @@ -537,6 +550,7 @@ class X2GoTerminalSession(object): - PulseAudio - Esound (not tested very much) + @raise X2GoControlSessionException: if the control session of this terminal session is not connected """ @@ -608,6 +622,7 @@ class X2GoTerminalSession(object): """\ Initialize Paramiko/SSH reverse forwarding tunnel for X2Go folder sharing. + """ if not self.control_session.is_sshfs_available(): raise x2go_exceptions.X2GoUserException('Remote user %s is not allowed to share SSHFS resources with the server.' % self.session_info.username) @@ -650,6 +665,7 @@ class X2GoTerminalSession(object): """\ Shutdown (pause) Paramiko/SSH reverse forwarding tunnel for X2Go sound. + """ self._x2go_pause_rev_fw_tunnel('snd') @@ -657,6 +673,7 @@ class X2GoTerminalSession(object): """\ Shutdown (pause) Paramiko/SSH reverse forwarding tunnel for X2Go folder sharing. + """ self._x2go_pause_rev_fw_tunnel('sshfs') @@ -664,6 +681,7 @@ class X2GoTerminalSession(object): """\ Initialize X2Go print spooling. + @raise X2GoUserException: if the X2Go printing feature is not available to this user """ @@ -695,7 +713,7 @@ class X2GoTerminalSession(object): @param print_action: print action name or object (i.e. an instance of C{X2GoPrintAction*} classes) @type print_action: C{str} or C{X2GoPrintAction*} @param kwargs: print action specific parameters - @type kwargs: dict + @type kwargs: C{dict} """ self.print_queue.set_print_action(print_action, logger=self.logger, **kwargs) @@ -704,6 +722,7 @@ class X2GoTerminalSession(object): """\ Shutdown (pause) the X2Go Print Queue thread. + """ if self.print_queue is not None: self.print_queue.pause() @@ -712,7 +731,9 @@ class X2GoTerminalSession(object): """\ Return the server-side printing spooldir path. + @return: the directory for remote print job spooling + @rtype: C{str} """ @@ -722,11 +743,10 @@ class X2GoTerminalSession(object): """\ Initialize the X2Go MIME box. Open/process incoming files from the server-side locally. - @param mimebox_extensions: file name extensions that are allowed for local opening/processing + @param mimebox_extensions: file name extensions that are allowed for local opening/processing (Default value = []) @type mimebox_extensions: C{list} - @param mimebox_action: MIME box action given as name or object (i.e. an instance of C{X2GoMIMEboxAction*} classes). + @param mimebox_action: MIME box action given as name or object (i.e. an instance of C{X2GoMIMEboxAction*} classes). (Default value = None) @type mimebox_action: C{str} or C{obj} - @raise X2GoUserException: if the X2Go MIME box feature is not available to this user """ @@ -757,7 +777,7 @@ class X2GoTerminalSession(object): @param mimebox_action: MIME box action name or object (i.e. an instance of C{X2GoMIMEboxAction*} classes) @type mimebox_action: C{str} or C{X2GoMIMEboxAction*} @param kwargs: MIME box action specific parameters - @type kwargs: dict + @type kwargs: C{dict} """ self.mimebox_queue.set_mimebox_action(mimebox_action, logger=self.logger, **kwargs) @@ -766,6 +786,7 @@ class X2GoTerminalSession(object): """\ Shutdown (pause) the X2Go MIME box Queue thread. + """ if self.mimebox_queue is not None: self.mimebox_queue.pause() @@ -774,7 +795,9 @@ class X2GoTerminalSession(object): """\ Return the server-side MIME box spooldir path. + @return: the directory where remote MIME box jobs are placed + @rtype: C{str} """ @@ -784,6 +807,7 @@ class X2GoTerminalSession(object): """\ Initialize Telekinesis client for X2Go. + """ if self.telekinesis_client is not None: del self.telekinesis_client @@ -806,7 +830,9 @@ class X2GoTerminalSession(object): """\ Test if this terminal's session info object is write-protected. + @return: C{True}, if session info object is read-only, C{False} for read-write. + @rtype: C{bool} """ @@ -816,6 +842,7 @@ class X2GoTerminalSession(object): """\ Protect this terminal session's info object against updates. + """ self.session_info.protect() @@ -823,6 +850,7 @@ class X2GoTerminalSession(object): """\ Allow session info updates from within the list_sessions method of the control session. + """ self.session_info.unprotect() @@ -831,15 +859,13 @@ class X2GoTerminalSession(object): Share a local folder with the X2Go session. @param local_path: the full path to an existing folder on the local - file system + file system (Default value = None) @type local_path: C{str} @param folder_type: one of 'disk' (a folder on your local hard drive), 'rm' (removeable device), - 'cdrom' (CD/DVD Rom) or 'spool' (for X2Go print spooling) + 'cdrom' (CD/DVD Rom) or 'spool' (for X2Go print spooling) (Default value = 'disk') @type folder_type: C{str} - @return: returns C{True} if the local folder has been successfully mounted within the X2Go server session @rtype: C{bool} - @raise X2GoUserException: if local folder sharing is not available to this user @raise Exception: any other exception occuring on the way is passed through by this method @@ -961,7 +987,9 @@ class X2GoTerminalSession(object): """\ Unshare all local folders mount in the X2Go session. + @return: returns C{True} if all local folders could be successfully unmounted from the X2Go server session + @rtype: C{bool} """ @@ -984,6 +1012,8 @@ class X2GoTerminalSession(object): """\ Unshare local folder given as <local_path> from X2Go session. + @param local_path: the full path to an existing folder on the local + file system (Default value = None) @return: returns C{True} if the local folder <local_path> could be successfully unmounted from the X2Go server session @rtype: C{bool} @@ -1008,7 +1038,9 @@ class X2GoTerminalSession(object): """\ Retrieve the session's color depth. + @return: the session's color depth + @rtype: C{int} """ @@ -1021,7 +1053,7 @@ class X2GoTerminalSession(object): The session window title will be provider in the C{session_title} property of this method. - @param dont_set: generate the session window title, but do not actually set it + @param dont_set: generate the session window title, but do not actually set it (Default value = False) @type dont_set: C{bool} """ @@ -1066,7 +1098,7 @@ class X2GoTerminalSession(object): A background thread will get spawned for this operation. - @param timeout: try for <timeout> seconds to find the session window + @param timeout: try for <timeout> seconds to find the session window (Default value = 60) @type timeout: C{int} """ @@ -1077,7 +1109,7 @@ class X2GoTerminalSession(object): Try for <timeout> seconds to find the X2Go session window of this terminal session. - @param timeout: try for <timeout> seconds to find the session window + @param timeout: try for <timeout> seconds to find the session window (Default value = 0) @type timeout: C{int} """ @@ -1110,6 +1142,7 @@ class X2GoTerminalSession(object): . If the file already exists, its content gets update. + """ session_window_file = os.path.join(self.session_info.local_container, 'session.window') if self.session_window is not None: @@ -1136,7 +1169,7 @@ class X2GoTerminalSession(object): @param title: new title for the terminal session's session window @type title: C{str} - @param timeout: try for <timeout> seconds to find the session window + @param timeout: try for <timeout> seconds to find the session window (Default value = 60) @type timeout: C{int} """ @@ -1148,7 +1181,7 @@ class X2GoTerminalSession(object): @param title: new title for the terminal session's session window @type title: C{str} - @param timeout: try for <timeout> seconds to find the session window + @param timeout: try for <timeout> seconds to find the session window (Default value = 0) @type timeout: C{int} """ @@ -1176,18 +1209,18 @@ class X2GoTerminalSession(object): A background thread will get spawned for this operation. - @param timeout: try for <timeout> seconds to raise the session window + @param timeout: try for <timeout> seconds to raise the session window (Default value = 60) @type timeout: C{int} """ gevent.spawn(self._raise_session_window, timeout=timeout) def _raise_session_window(self, timeout=0): - """ + """\ Try for <timeout> seconds to raise the X2Go session window of this terminal session to the top and bring it to focus. - @param timeout: try for <timeout> seconds to raise the session window + @param timeout: try for <timeout> seconds to raise the session window (Default value = 0) @type timeout: C{int} """ @@ -1211,7 +1244,6 @@ class X2GoTerminalSession(object): @param cmd: session command @type cmd: C{str} - @return: C{True} if this method reckons that the command is executable on the remote X2Go server @rtype: C{bool} @@ -1252,11 +1284,10 @@ class X2GoTerminalSession(object): one or more commands can be executed with L{x2go.backends.terminal.plain.X2GoTerminalSession.run_command()} within the current X2Go session. - @param cmd: Command to be run + @param cmd: Command to be run (Default value = None) @type cmd: C{str} - @param env: add server-side environment variables + @param env: add server-side environment variables (Default value = {}) @type env: C{dict} - @return: stdout.read() and stderr.read() as returned by the run command on the X2Go server @rtype: C{tuple} of C{str} @@ -1316,6 +1347,7 @@ class X2GoTerminalSession(object): """\ Is this (terminal) session a desktop session? + @return: Returns C{True} is this session is a desktop session. @rtype: C{bool} @@ -1328,6 +1360,7 @@ class X2GoTerminalSession(object): """\ Is this (terminal) session a published applications provider? + @return: Returns C{True} is this session is a provider session for published applications. @rtype: C{bool} @@ -1340,11 +1373,10 @@ class X2GoTerminalSession(object): """\ Set the keyboard layout and variant for this (running) session. - @param layout: keyboard layout to be set + @param layout: keyboard layout to be set (Default value = 'null') @type layout: C{str} - @param variant: keyboard variant to be set + @param variant: keyboard variant to be set (Default value = 'null') @type variant: C{str} - @return: returns C{True} if the {setxkbmap} command could be executed successfully. @rtype: C{bool} @@ -1380,9 +1412,9 @@ class X2GoTerminalSession(object): @param exec_name: application to be executed @type exec_name: C{str} - @param timeout: execution timeout + @param timeout: execution timeout (Default value = 20) @type timeout: C{int} - @param env: session environment dictionary + @param env: session environment dictionary (Default value = {}) @type env: C{dict} """ @@ -1412,6 +1444,7 @@ class X2GoTerminalSession(object): """\ X2Go session OK? + @return: Returns C{True} if this X2Go (terminal) session is up and running, C{False} otherwise. @rtype: C{bool} @@ -1424,6 +1457,7 @@ class X2GoTerminalSession(object): """\ X2Go session running? + @return: Returns C{True} if this X2Go (terminal) session is in running state, C{False} otherwise. @rtype: C{bool} @@ -1435,6 +1469,7 @@ class X2GoTerminalSession(object): """\ X2Go session suspended? + @return: Returns C{True} if this X2Go (terminal) session is in suspended state, C{False} otherwise. @rtype: C{bool} @@ -1446,6 +1481,7 @@ class X2GoTerminalSession(object): """\ X2Go session connected? + @return: Returns C{True} if this X2Go session's Paramiko/SSH transport is connected/authenticated, C{False} else. @rtype: C{bool} @@ -1457,9 +1493,9 @@ class X2GoTerminalSession(object): """\ Start a new X2Go session. + @return: C{True} if session startup has been successful and the X2Go proxy is up-and-running @rtype: C{bool} - @raise X2GoTerminalSessionException: if the session startup failed @raise X2GoDesktopSharingDenied: if desktop sharing fails because of denial by the user running the desktop to be shared @@ -1576,9 +1612,9 @@ class X2GoTerminalSession(object): """\ Resume a running/suspended X2Go session. + @return: C{True} if the session could successfully be resumed @rtype: C{bool} - @raise X2GoTerminalSessionException: if the terminal session failed to update server-side reported port changes """ @@ -1682,6 +1718,7 @@ class X2GoTerminalSession(object): """\ Suspend this X2Go (terminal) session. + @return: C{True} if the session terminal could be successfully suspended @rtype: C{bool} @@ -1699,6 +1736,7 @@ class X2GoTerminalSession(object): """\ Terminate this X2Go (terminal) session. + @return: C{True} if the session could be successfully terminated @rtype: C{bool} @@ -1718,6 +1756,7 @@ class X2GoTerminalSession(object): """\ Let the X2Go proxy command cleanly die away... (by calling its destructor). + """ if self.proxy is not None: self.proxy.__del__() @@ -1727,6 +1766,7 @@ class X2GoTerminalSession(object): """\ Let the attached Telekinesis client cleanly die away... (by calling its destructor). + """ if self.telekinesis_client is not None: self.telekinesis_client.__del__() @@ -1736,6 +1776,7 @@ class X2GoTerminalSession(object): """\ Do some cleanup after this session has terminated. + """ # this method might be called twice (directly and from update_status in the session # registry instance. So we have to make sure, that this code will not fail @@ -1757,6 +1798,7 @@ class X2GoTerminalSession(object): """\ Test if this terminal session is a rootless session. + @return: C{True} if this session is of session type rootless ('R'). @rtype: C{bool} @@ -1768,6 +1810,7 @@ class X2GoTerminalSession(object): """\ Test if this terminal session is a desktop sharing (aka shadow) session. + @return: C{True} if this session is of session type shadow ('S'). @rtype: C{bool} @@ -1779,6 +1822,7 @@ class X2GoTerminalSession(object): """\ Test if this terminal session is a published applications session. + @return: C{True} if this session is of session type published applications ('P'). @rtype: C{bool} diff --git a/x2go/cache.py b/x2go/cache.py index d66d5ea..02d2f7c 100644 --- a/x2go/cache.py +++ b/x2go/cache.py @@ -52,6 +52,7 @@ class X2GoListSessionsCache(object): the server's session/desktop list is available without delay, even on slow internet connections. + """ x2go_listsessions_cache = {} @@ -97,6 +98,7 @@ class X2GoListSessionsCache(object): session profiles are still connected). If not so, remove invalid cache entries from the session list cache. + """ for profile_name in list(self.x2go_listsessions_cache.keys()): if profile_name not in self.client_instance.client_connected_profiles(return_profile_names=True): @@ -106,9 +108,9 @@ class X2GoListSessionsCache(object): """\ Update L{X2GoListSessionsCache} for all connected session profiles. - @param update_sessions: cache recent session lists from all connected servers + @param update_sessions: cache recent session lists from all connected servers (Default value = True) @type update_sessions: C{bool} - @param update_desktops: cache recent desktop lists from all connected servers + @param update_desktops: cache recent desktop lists from all connected servers (Default value = False) @type update_desktops: C{bool} """ @@ -123,11 +125,11 @@ class X2GoListSessionsCache(object): @param profile_name: name of profile to update @type profile_name: C{str} - @param update_sessions: cache recent session list from server + @param update_sessions: cache recent session list from server (Default value = True) @type update_sessions: C{bool} - @param update_desktops: cache recent desktop list from server + @param update_desktops: cache recent desktop list from server (Default value = False) @type update_desktops: C{bool} - @param update_mounts: cache list of client-side mounts on server + @param update_mounts: cache list of client-side mounts on server (Default value = False) @type update_mounts: C{bool} """ @@ -150,8 +152,10 @@ class X2GoListSessionsCache(object): @param profile_name: name of profile to update @type profile_name: C{str} - + @param control_session: X2Go control session instance + @type control: L{X2GoControlSession} @raise X2GoControlSessionException: if the control session's C{list_mounts} method fails + """ try: self.x2go_listsessions_cache[profile_name]['mounts'] = {} @@ -179,8 +183,8 @@ class X2GoListSessionsCache(object): @type profile_name: C{str} @param control_session: X2Go control session instance @type control_session: C{obj} - @raise X2GoControlSessionException: if the control session's C{list_desktop} method fails + """ try: if control_session is not None and not control_session.has_session_died(): @@ -201,8 +205,10 @@ class X2GoListSessionsCache(object): @param profile_name: name of profile to update @type profile_name: C{str} - + @param control_session: X2Go control session instance + @type control_session: C{obj} @raise X2GoControlSessionException: if the control session's C{list_sessions} method fails + """ try: if control_session is not None and not control_session.has_session_died(): @@ -222,7 +228,6 @@ class X2GoListSessionsCache(object): @param session_uuid: unique identifier of session to query cache for @type session_uuid: C{str} - @return: a data object containing available session information @rtype: C{X2GoServerSessionList*} instance (or C{None}) @@ -241,7 +246,6 @@ class X2GoListSessionsCache(object): @param session_uuid: unique identifier of session to query cache for @type session_uuid: C{str} - @return: a list of strings representing X2Go desktop sessions available for sharing @rtype: C{list} (or C{None}) @@ -260,7 +264,6 @@ class X2GoListSessionsCache(object): @param session_uuid: unique identifier of session to query cache for @type session_uuid: C{str} - @return: a list of strings representing mounted client shares @rtype: C{list} (or C{None}) @@ -275,11 +278,12 @@ class X2GoListSessionsCache(object): """\ Check if session information is cached. - @param profile_name: name of profile to update + @param profile_name: name of profile to update (Default value = None) @type profile_name: C{str} - @param session_uuid: unique identifier of session to query cache for + @param session_uuid: unique identifier of session to query cache for (Default value = None) @type session_uuid: C{str} - + @param cache_type: cache type (e.g. 'mounts', 'desktops', 'sessions') (Default value = None) + @type cache_type: C{str} @return: C{True} if session information is cached @rtype: C{bool} diff --git a/x2go/checkhosts.py b/x2go/checkhosts.py index 378da3e..6345063 100644 --- a/x2go/checkhosts.py +++ b/x2go/checkhosts.py @@ -42,6 +42,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Skeleton class for Python X2Go's missing host key policies. + """ def __init__(self, caller=None, session_instance=None, fake_hostname=None): """\ @@ -59,6 +60,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the Paramiko SSH/Client. + @return: the associated X2Go control session instance. @rtype: C{X2GoControlSession*} instance @@ -69,6 +71,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the server hostname:port expression of the server to be validated. + @return: hostname:port @rtype: C{str} @@ -79,6 +82,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the server hostname string of the server to be validated. + @return: hostname @rtype: C{str} @@ -92,6 +96,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the server port of the server to be validated. + @return: port @rtype: C{str} @@ -105,6 +110,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the host key of the server to be validated. + @return: host key @rtype: Paramiko/SSH key instance @@ -115,6 +121,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the host key name of the server to be validated. + @return: host key name (RSA, DSA, ECDSA...) @rtype: C{str} @@ -125,6 +132,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): """\ Retrieve the host key fingerprint of the server to be validated. + @return: host key fingerprint @rtype: C{str} @@ -136,6 +144,7 @@ class X2GoMissingHostKeyPolicy(paramiko.MissingHostKeyPolicy): Retrieve the (colonized) host key fingerprint of the server to be validated. + @return: host key fingerprint (with colons) @rtype: C{str} @@ -182,6 +191,7 @@ class X2GoInteractiveAddPolicy(X2GoMissingHostKeyPolicy): L{X2GoClient.HOOK_check_host_dialog()} method or the L{X2GoSession.HOOK_check_host_dialog()} method and hook some interactive user dialog to either of them. + """ def missing_host_key(self, client, hostname, key): """\ @@ -202,7 +212,6 @@ class X2GoInteractiveAddPolicy(X2GoMissingHostKeyPolicy): @type hostname: C{str} @param key: host key to validate @type key: Paramiko/SSH key instance - @raise X2GoHostKeyException: if the X2Go server host key is not in the C{known_hosts} file @raise X2GoSSHProxyHostKeyException: if the SSH proxy host key is not in the C{known_hosts} file @raise SSHException: if this instance does not know its {self.session_instance} @@ -265,12 +274,10 @@ def check_ssh_host_key(x2go_sshclient_instance, hostname, port=22): @type x2go_sshclient_instance: C{X2GoControlSession*} instance @param hostname: hostname of server to validate @type hostname: C{str} - @param port: port of server to validate + @param port: port of server to validate (Default value = 22) @type port: C{int} - @return: returns a tuple with the following components (<host_ok>, <hostname>, <port>, <fingerprint>, <fingerprint_type>) @rtype: C{tuple} - @raise SSHException: if an SSH exception occurred, that we did not provocate in L{X2GoInteractiveAddPolicy.missing_host_key()} """ diff --git a/x2go/cleanup.py b/x2go/cleanup.py index b1d95b6..d003ff5 100644 --- a/x2go/cleanup.py +++ b/x2go/cleanup.py @@ -58,9 +58,9 @@ def x2go_cleanup(e=None, threads=None): @param e: if L{x2go_cleanup} got called as you caught an exception in your code this can be the C{Exception} that we will process at the end of the clean-up (or if clean-up failed or was not - appropriate) + appropriate) (Default value = None) @type e: C{exception} - @param threads: a list of threads to clean up + @param threads: a list of threads to clean up (Default value = None) @type threads: C{list} """ diff --git a/x2go/client.py b/x2go/client.py index 9d5ba17..57fd9fa 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -166,6 +166,7 @@ class X2GoClient(object): session object etc.) and connected to it (authentication). For these two steps use these methods: L{X2GoClient.register_session()} and L{X2GoClient.connect_session()}. + """ lang = 'en' @@ -378,7 +379,7 @@ class X2GoClient(object): """\ HOOK method: called if a session demands to auto connect the session profile. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} """ @@ -388,7 +389,7 @@ class X2GoClient(object): """\ HOOK method: called if a session demands to auto connect the session profile. - @param profile_name: profile name of a session that triggered this hook method + @param profile_name: profile name of a session that triggered this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} """ @@ -399,11 +400,10 @@ class X2GoClient(object): HOOK method: called after a broker connection failed for a certain profile. This hook can be used to allow the user to decide how to proceed after connection problems with the broker. - @param profile_name: profile name of a session that triggered this hook method + @param profile_name: profile name of a session that triggered this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param is_profile_connected: C{True} if the given session profile is already conneced to the server + @param is_profile_connected: C{True} if the given session profile is already conneced to the server (Default value = False) @type is_profile_connected: C{bool} - @return: If this hook returns C{True}, the session startup/resumption will be continued, even if the broker connection is down. (Default: broker connection problems cause session start-up to fail). @rtype: C{bool} @@ -416,7 +416,7 @@ class X2GoClient(object): """\ HOOK method: called if the startup of a session failed. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} """ @@ -426,7 +426,7 @@ class X2GoClient(object): """\ HOOK method: called if the startup of a shadow session was denied by the other user. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} """ @@ -436,7 +436,7 @@ class X2GoClient(object): """\ HOOK method: called if the x2golistdesktops command generates a timeout due to long execution time. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} """ @@ -446,9 +446,9 @@ class X2GoClient(object): """\ HOOK method: called if it is tried to connect to a (seen before) sharable desktop that's not available (anymore). - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param desktop: desktop identifier (the X session's $DISPLAY) + @param desktop: desktop identifier (the X session's $DISPLAY) (Default value = 'UNKNOWN') @type desktop: C{str} """ @@ -463,6 +463,7 @@ class X2GoClient(object): HOOK method: called if the Python X2Go module could not find any usable XServer application to start. You will not be able to start X2Go sessions without an XServer. + """ self.logger('the Python X2Go module could not find any usable XServer application, you will not be able to start X2Go sessions without an XServer', loglevel=log.loglevel_WARN) @@ -471,9 +472,9 @@ class X2GoClient(object): HOOK method: called if an incoming print job has been detected by L{X2GoPrintQueue} and a print dialog box is requested. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -485,9 +486,9 @@ class X2GoClient(object): @param cmd: the command that failed @type cmd: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -499,9 +500,9 @@ class X2GoClient(object): @param filename: file name of the incoming MIME box job @type filename: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -513,13 +514,13 @@ class X2GoClient(object): @param filename: file name of the print job that failed @type filename: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} - @param err_msg: if available, an appropriate error message + @param err_msg: if available, an appropriate error message (Default value = 'GENERIC_ERROR') @type err_msg: C{str} - @param printer: if available, the printer name the print job failed on + @param printer: if available, the printer name the print job failed on (Default value = None) @type printer: C{str} """ @@ -532,17 +533,16 @@ class X2GoClient(object): """\ HOOK method: called if a host check is requested. This hook has to either return C{True} (default) or C{False}. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param host: SSH server name to validate + @param host: SSH server name to validate (Default value = 'UNKNOWN') @type host: C{str} - @param port: SSH server port to validate + @param port: SSH server port to validate (Default value = 22) @type port: C{int} - @param fingerprint: the server's fingerprint + @param fingerprint: the server's fingerprint (Default value = 'no fingerprint') @type fingerprint: C{str} - @param fingerprint_type: finger print type (like RSA, DSA, ...) + @param fingerprint_type: finger print type (like RSA, DSA, ...) (Default value = 'UNKNOWN') @type fingerprint_type: C{str} - @return: if host validity is verified, this hook method should return C{True} @rtype: C{bool} @@ -589,9 +589,9 @@ class X2GoClient(object): """\ HOOK method: called if a sound tunnel setup failed. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -601,11 +601,11 @@ class X2GoClient(object): """\ HOOK method: called if a reverse port forwarding request has been denied. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} - @param server_port: remote server port (starting point of reverse forwarding tunnel) + @param server_port: remote server port (starting point of reverse forwarding tunnel) (Default value = 0) @type server_port: C{str} """ @@ -615,15 +615,15 @@ class X2GoClient(object): """\ HOOK method: called if a port forwarding tunnel setup failed. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} - @param chain_host: hostname of chain host (forwarding tunnel end point) + @param chain_host: hostname of chain host (forwarding tunnel end point) (Default value = 'UNKNOWN') @type chain_host: C{str} - @param chain_port: port of chain host (forwarding tunnel end point) + @param chain_port: port of chain host (forwarding tunnel end point) (Default value = 0) @type chain_port: C{str} - @param subsystem: information on the subsystem that provoked this hook call + @param subsystem: information on the subsystem that provoked this hook call (Default value = None) @type subsystem: C{str} """ @@ -638,11 +638,11 @@ class X2GoClient(object): """\ HOOK method: called if a session has been started by this instance of L{X2GoClient}. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -652,11 +652,11 @@ class X2GoClient(object): """\ HOOK method: called if a session has been started by another C{x2goclient}. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -666,11 +666,11 @@ class X2GoClient(object): """\ HOOK method: called if a session has been resumed by this instance of L{X2GoClient}. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -680,11 +680,11 @@ class X2GoClient(object): """\ HOOK method: called if a session has been resumed by another C{x2goclient}. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -694,11 +694,11 @@ class X2GoClient(object): """\ HOOK method: called after server connect if an already running session has been found. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -708,11 +708,11 @@ class X2GoClient(object): """\ HOOK method: called if a session has been suspended by this instance of L{X2GoClient}. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -722,11 +722,11 @@ class X2GoClient(object): """\ HOOK method: called if a session has been suspended by another C{x2goclient}. - @param session_uuid: unique session identifier of the calling session + @param session_uuid: unique session identifier of the calling session (Default value = 'UNKNOWN') @type session_uuid: C{str} - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -736,9 +736,9 @@ class X2GoClient(object): """\ HOOK method: called if X2Go client-side printing is not available. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -748,9 +748,9 @@ class X2GoClient(object): """\ HOOK method: called if the X2Go MIME box is not available. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -760,9 +760,9 @@ class X2GoClient(object): """\ HOOK method: called if X2Go client-side folder-sharing is not available. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -772,9 +772,9 @@ class X2GoClient(object): """\ HOOK method: called if the X2Go server denies SSHFS access. - @param profile_name: profile name of session that called this hook method + @param profile_name: profile name of session that called this hook method (Default value = 'UNKNOWN') @type profile_name: C{str} - @param session_name: X2Go session name + @param session_name: X2Go session name (Default value = 'UNKNOWN') @type session_name: C{str} """ @@ -784,8 +784,10 @@ class X2GoClient(object): """\ Retrieve the settings root directory of this L{X2GoClient} instance. + @return: X2Go client root directory @rtype: C{str} + """ return os.path.normpath(self.client_rootdir) __get_client_rootdir = get_client_rootdir @@ -796,6 +798,7 @@ class X2GoClient(object): Does this L{X2GoClient} instance have a customized root dir path? Equals C{True} in case it has. + """ return self._has_custom_client_rootdir __has_custom_client_rootdir = has_custom_client_rootdir @@ -804,8 +807,10 @@ class X2GoClient(object): """\ Retrieve the sessions root directory of this L{X2GoClient} instance. + @return: X2Go sessions root directory @rtype: C{str} + """ return os.path.normpath(self.sessions_rootdir) __get_sessions_rootdir = get_sessions_rootdir @@ -814,8 +819,10 @@ class X2GoClient(object): """\ Retrieve the SSH client root dir used with this L{X2GoClient} instance. + @return: SSH client root directory @rtype: C{str} + """ return os.path.normpath(self.ssh_rootdir) __get_ssh_rootdir = get_ssh_rootdir @@ -824,6 +831,7 @@ class X2GoClient(object): """\ Query the local user's username (i.e. the user running the X2Go client). + @return: the local username this L{X2GoClient} instance runs as @rtype: C{str} @@ -838,9 +846,8 @@ class X2GoClient(object): @param return_objects: if set to C{True} this methods returns a list of L{X2GoSession} instances, otherwise a list of session UUIDs representing the corresponding - registered sessions is returned + registered sessions is returned (Default value = False) @type return_objects: C{bool} - @return: a Python dictionary containing one registered session for each available session profile configuration, whereas the profile names are used as dictionary keys and L{X2GoSession} instances as their values @@ -889,44 +896,45 @@ class X2GoClient(object): also be passed to this method---they will override the option values retrieved from the session profile. - @param server: hostname of the remote X2Go server + @param server: hostname of the remote X2Go server (Default value = None) @type server: C{str} @param profile_id: id (config section name) of a session profile to load - from your session config + from your session config (Default value = None) @type profile_id: C{str} @param profile_name: name of a session profile to load from your session - config + config (Default value = None) @type profile_name: C{str} - @param allow_printing: enable X2Go printing support for the to-be-registered X2Go session + @param session_name:session name to register (by its name) (Default value = None) + @type session_name: C{str} + @param allow_printing: enable X2Go printing support for the to-be-registered X2Go session (Default value = False) @type allow_printing: C{bool} - @param allow_share_local_folders: set local folder sharing to enabled/disabled + @param allow_share_local_folders: set local folder sharing to enabled/disabled (Default value = False) @type allow_share_local_folders: C{bool} @param share_local_folders: a list of local folders (as strings) to be shared directly - after session start up + after session start up (Default value = []) @type share_local_folders: C{list} - @param allow_mimebox: enable X2Go MIME box support for the to-be-registered X2Go session + @param allow_mimebox: enable X2Go MIME box support for the to-be-registered X2Go session (Default value = False) @type allow_mimebox: C{bool} - @param mimebox_extensions: MIME box support is only allowed for the given file extensions + @param mimebox_extensions: MIME box support is only allowed for the given file extensions (Default value = []) @type mimebox_extensions: C{list} - @param mimebox_action: MIME box action to use on incoming MIME job files + @param mimebox_action: MIME box action to use on incoming MIME job files (Default value = 'OPEN') @type mimebox_action: C{str} @param add_to_known_hosts: add unknown host keys to the C{known_hosts} file and accept the connection - automatically + automatically (Default value = False) @type add_to_known_hosts: C{bool} - @param known_hosts: full path to C{known_hosts} file + @param known_hosts: full path to C{known_hosts} file (Default value = None) @type known_hosts: C{str} - @param forward_sshagent: forward SSH agent authentication requests to the X2Go client-side + @param forward_sshagent: forward SSH agent authentication requests to the X2Go client-side (Default value = False) @type forward_sshagent: C{bool} @param proxy_options: a set of very C{X2GoProxy*} backend specific options; any option that is not known - to the C{X2GoProxy*} backend will simply be ignored + to the C{X2GoProxy*} backend will simply be ignored (Default value = {}) @type proxy_options: C{dict} @param return_object: normally this method returns a unique session UUID. If C{return_object} is set to C{True} an X2GoSession object will be returned - instead + instead (Default value = False) @type return_object: C{bool} @param kwargs: any option that is also valid for the L{X2GoSession} constructor @type kwargs: C{dict} - @return: a unique identifier (UUID) for the newly registered X2Go session (or an X2GoSession object if C{return_object} is set to True @rtype: C{str} @@ -1067,7 +1075,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: the remote username the X2Go session runs as @rtype: C{str} @@ -1083,7 +1090,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: the host an X2Go session is connected to (as an C{(addr,port)} tuple) @rtype: tuple @@ -1100,7 +1106,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: the hostname for the queried X2Go session as specified by the calling application @rtype: str @@ -1116,7 +1121,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: the L{X2GoSession} instance @rtype: obj @@ -1133,11 +1137,10 @@ class X2GoClient(object): @param session_name: the X2Go session's UUID registry hash @type session_name: C{str} - @param return_object: session UUID hash or L{X2GoSession} instance wanted? + @param return_object: session UUID hash or L{X2GoSession} instance wanted? (Default value = False) @type return_object: C{bool} - @param match_profile_name: only return sessions that match this profile name + @param match_profile_name: only return sessions that match this profile name (Default value = None) @type match_profile_name: C{str} - @return: the X2Go session's UUID registry hash or L{X2GoSession} instance @rtype: C{str} or L{X2GoSession} instance @@ -1155,7 +1158,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: X2Go session name @rtype: C{str} @@ -1170,7 +1172,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: X2Go session info @rtype: C{obj} @@ -1183,13 +1184,23 @@ class X2GoClient(object): Retrieve the server-side X2Go published applications menu for the session registered under C{session_uuid} or for profile name C{profile_name}. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} - @param profile_name: a valid session profile name + @param profile_name: a valid session profile name (Default value = None) @type profile_name: C{str} - - @return: a representative of the published applications menu tree - @rtype: C{dict} + @param lang: locale/language identifier (Default value = None) + @type lang: C{str} + @param refresh: force reload of the menu tree from X2Go server (Default value = False) + @type refresh: C{bool} + @param raw: retrieve a raw output of the server list of published applications (Default value = False) + @type raw: C{bool} + @param very_raw: retrieve a very raw output of the server list of published applications (Default value = False) + @type very_raw: C{bool} + @param max_no_submenus: Number of applications before applications are put into XDG category submenus + (Default value = defaults.PUBAPP_MAX_NO_SUBMENUS) + @type max_no_submenus: C{int} + @return: an i18n capable menu tree packed as a Python dictionary + @rtype: C{list} """ if session_uuid is None and profile_name: @@ -1217,8 +1228,7 @@ class X2GoClient(object): @type session_uuid: C{str} @param username: new user name to be used for session authentication @type username: C{str} - - @return: return C{True} on success + @return: returns C{True} on success @rtype: C{bool} """ @@ -1231,8 +1241,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - - @return: return C{True} if host validation has been successful. + @return: returns C{True} if host validation has been successful. @rtype: C{bool} """ @@ -1244,8 +1253,11 @@ class X2GoClient(object): Check if session with unique identifier <session_uuid> is configured to re-use the X2Go session's password / key for proxy authentication, as well. + @param session_uuid: the X2Go session's UUID registry hash + @type session_uuid: C{str} @return: returns C{True} if the session is configured to re-use session password / key for proxy authentication @rtype: C{bool} + """ return self.session_registry(session_uuid).reuses_sshproxy_authinfo() __session_reuses_sshproxy_authinfo = session_reuses_sshproxy_authinfo @@ -1255,6 +1267,8 @@ class X2GoClient(object): Check if session with unique identifier <session_uuid> is configured to use an intermediate SSH proxy server. + @param session_uuid: the X2Go session's UUID registry hash + @type session_uuid: C{str} @return: returns C{True} if the session is configured to use an SSH proxy, C{False} otherwise. @rtype: C{bool} @@ -1269,7 +1283,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: returns C{True} if the session's SSH proxy can auto-connect, C{False} otherwise, C{None} if no control session has been set up yet. @rtype: C{bool} @@ -1285,7 +1298,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: returns C{True} if the session can auto-connect, C{False} otherwise, C{None} if no control session has been set up yet. @rtype: C{bool} @@ -1303,7 +1315,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: returns C{True} if the session could be auto-connected. @rtype: C{bool} @@ -1329,34 +1340,33 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param username: user name to be used for session authentication + @param username: user name to be used for session authentication (Default value = None) @type username: C{str} @param password: the user's password for the X2Go server that is going to be - connected to + connected to (Default value = None) @type password: C{str} @param passphrase: a passphrase to use for unlocking a private key in case the password is already needed for - two-factor authentication + two-factor authentication (Default value = None) @type passphrase: C{str} - @param sshproxy_user: user name to be used for SSH proxy authentication + @param sshproxy_user: user name to be used for SSH proxy authentication (Default value = None) @type sshproxy_user: C{str} - @param sshproxy_password: the SSH proxy user's password + @param sshproxy_password: the SSH proxy user's password (Default value = None) @type sshproxy_password: C{str} @param sshproxy_passphrase: a passphrase to use for unlocking a private key needed for the SSH proxy host in case the sshproxy_password is already needed for - two-factor authentication + two-factor authentication (Default value = None) @type sshproxy_passphrase: C{str} @param add_to_known_hosts: non-Paramiko option, if C{True} paramiko.AutoAddPolicy() is used as missing-host-key-policy. If set to C{False} L{checkhosts.X2GoInteractiveAddPolicy()} - is used + is used (Default value = False) @type add_to_known_hosts: C{bool} @param force_password_auth: disable SSH pub/priv key authentication mechanisms - completely + completely (Default value = False) @type force_password_auth: C{bool} @param sshproxy_force_password_auth: disable SSH pub/priv key authentication mechanisms - completely for SSH proxy connection + completely for SSH proxy connection (Default value = False) @type sshproxy_force_password_auth: C{bool} - @return: returns True if this method has been successful @rtype: C{bool} @@ -1384,6 +1394,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} + """ self.session_registry(session_uuid).disconnect() if self.use_listsessions_cache: @@ -1421,6 +1432,7 @@ class X2GoClient(object): action arguments), for possible print action arguments and their values see each individual print action class @type kwargs: C{dict} + @param **kwargs: """ self.session_registry(session_uuid).set_print_action(print_action=print_action, **kwargs) @@ -1434,7 +1446,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param title: new title for session window + @param title: new title for session window (Default value = '') @type title: C{str} """ @@ -1448,6 +1460,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} + """ self.session_registry(session_uuid).raise_session_window() __raise_session_window = raise_session_window @@ -1461,13 +1474,13 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param newest: if resuming, only resume newest/youngest session + @param newest: if resuming, only resume newest/youngest session (Default value = True) @type newest: C{bool} - @param oldest: if resuming, only resume oldest session + @param oldest: if resuming, only resume oldest session (Default value = False) @type oldest: C{bool} - @param all_suspended: if resuming, resume all suspended sessions + @param all_suspended: if resuming, resume all suspended sessions (Default value = False) @type all_suspended: C{bool} - @param start: if no session is to be resumed, start a new session + @param start: if no session is to be resumed, start a new session (Default value = True) @type start: C{bool} """ @@ -1488,7 +1501,6 @@ class X2GoClient(object): @type session_uuid: C{str} @param sessionopts: pass-through of options directly to the session instance's L{X2GoSession.start()} method @type sessionopts: C{dict} - @return: returns True if this method has been successful @rtype: C{bool} @@ -1514,22 +1526,24 @@ class X2GoClient(object): a to-be-shared session has be registered first with the L{X2GoClient} instance. - @param desktop: desktop ID of a sharable desktop in format <user>@<display> + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) + @type session_uuid: C{str} + @param desktop: desktop ID of a sharable desktop in format <user>@<display> (Default value = None) @type desktop: C{str} @param user: user name and display number can be given separately, here give the - name of the user who wants to share a session with you. + name of the user who wants to share a session with you. (Default value = None) @type user: C{str} @param display: user name and display number can be given separately, here give the - number of the display that a user allows you to be shared with. + number of the display that a user allows you to be shared with. (Default value = None) @type display: C{str} - @param share_mode: desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. + @param share_mode: desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. (Default value = 0) @type share_mode: C{int} @param sessionopts: pass-through of options directly to the session instance's L{X2GoSession.share_desktop()} method @type sessionopts: C{dict} - + @param check_desktop_list: check if the given desktop is available on the X2Go server; handle with care as + the server-side C{x2golistdesktops} command might block client I/O. (Default value = False) @return: True if the session could be successfully shared. @rtype: C{bool} - @raise X2GoDesktopSharingException: if a given desktop ID does not specify an available desktop session """ @@ -1554,18 +1568,16 @@ class X2GoClient(object): remote X2Go server (as specified when L{register_session} was called). - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @param match_profile_name: only resume a session if this profile name matches + @param match_profile_name: only resume a session if this profile name matches (Default value = None) @type match_profile_name: C{str} @param sessionopts: pass-through of options directly to the session instance's L{X2GoSession.resume()} method @type sessionopts: C{dict} - @return: returns True if this method has been successful @rtype: C{bool} - @raise X2GoClientException: if the method does not know what session to resume """ @@ -1605,13 +1617,12 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} @param session_name: the server-side name of an X2Go session (for - non-associated session suspend) + non-associated session suspend) (Default value = None) @type session_name: C{str} - @param match_profile_name: only suspend a session if this profile name matches + @param match_profile_name: only suspend a session if this profile name matches (Default value = None) @type match_profile_name: C{str} @param sessionopts: pass-through of options directly to the session instance's L{X2GoSession.suspend()} method @type sessionopts: C{dict} - @return: returns True if this method has been successful @rtype: C{bool} @@ -1657,13 +1668,12 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @param match_profile_name: only terminate a session if this profile name matches + @param match_profile_name: only terminate a session if this profile name matches (Default value = None) @type match_profile_name: C{str} @param sessionopts: pass-through of options directly to the session instance's L{X2GoSession.terminate()} method @type sessionopts: C{dict} - @return: returns True if this method has been successful @rtype: C{bool} @@ -1704,7 +1714,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: X2Go session profile name @rtype: C{str} @@ -1727,7 +1736,6 @@ class X2GoClient(object): @param session_uuid: the session profile name @type session_uuid: C{str} - @return: the X2Go session profile's id @rtype: C{str} @@ -1742,7 +1750,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: C{True} if session is ok, C{False} otherwise @rtype: C{bool} @@ -1757,7 +1764,6 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: C{True} if session is connected, C{False} otherwise @rtype: C{bool} @@ -1772,7 +1778,6 @@ class X2GoClient(object): @param profile_name: a valid session profile name @type profile_name: C{str} - @return: C{True} if profile has a connected session, C{False} otherwise @rtype: C{bool} @@ -1786,7 +1791,6 @@ class X2GoClient(object): @param profile_id_or_name: test existence of this session profile name (or id) @type profile_id_or_name: C{str} - @return: C{True} if session profile exists, C{False} otherwise @rtype: C{bool} @@ -1801,9 +1805,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @return: C{True} if session is running, C{False} otherwise @rtype: C{bool} @@ -1821,9 +1824,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @return: C{True} if session is suspended, C{False} otherwise @rtype: C{bool} @@ -1841,9 +1843,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @return: C{True} if session has terminated, C{False} otherwise @rtype: C{bool} @@ -1859,11 +1860,10 @@ class X2GoClient(object): Test if local folder sharing is available for X2Go session with unique ID <session_uuid> or session profile <profile_name>. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} - @param profile_name: alternatively, the profile name can be used to perform this query + @param profile_name: alternatively, the profile name can be used to perform this query (Default value = None) @type profile_name: C{str} - @return: returns C{True} if the profile/session supports local folder sharing @rtype: C{bool} @@ -1890,16 +1890,15 @@ class X2GoClient(object): on the X2Go server (via sshfs) and (if in desktop mode) provided as a desktop icon on your remote session's desktop. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} @param local_path: the full path to an existing folder on the local (client-side) - file system + file system (Default value = None) @type local_path: C{str} - @param folder_name: synonymous to C{local_path} + @param folder_name: synonymous to C{local_path} (Default value = None) @type folder_name: C{str} - @param profile_name: alternatively, the profile name can be used to share local folders + @param profile_name: alternatively, the profile name can be used to share local folders (Default value = None) @type profile_name: C{str} - @return: returns C{True} if the local folder has been successfully mounted @rtype: C{bool} @@ -1930,12 +1929,11 @@ class X2GoClient(object): server (via sshfs) for session with ID <session_uuid> will get unmounted. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} @param profile_name: alternatively, the profile name can be used to unshare - mounted folders + mounted folders (Default value = None) @type profile_name: C{str} - @return: returns C{True} if all local folders could be successfully unmounted @rtype: C{bool} @@ -1961,16 +1959,15 @@ class X2GoClient(object): server (via sshfs) for session with ID <session_uuid> will get unmounted. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} @param profile_name: alternatively, the profile name can be used to unshare - mounted folders + mounted folders (Default value = None) @type profile_name: C{str} @param local_path: the full path of a local folder that is mounted within X2Go session with session ID <session_uuid> (or recognized via profile name) and that - shall be unmounted from that session. + shall be unmounted from that session. (Default value = None) @type local_path: C{str} - @return: returns C{True} if all local folders could be successfully unmounted @rtype: C{bool} @@ -1992,13 +1989,12 @@ class X2GoClient(object): Get a list of local folders mounted within X2Go session with session hash <session_uuid> from this client. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} - @param profile_name: alternatively, the profile name can be used to get mounted folders of a session connected profile + @param profile_name: alternatively, the profile name can be used to get mounted folders of a session connected profile (Default value = None) @type profile_name: C{str} - @param check_list_mounts: query the server-side mount list for up-to-date information + @param check_list_mounts: query the server-side mount list for up-to-date information (Default value = False) @type check_list_mounts: C{bool} - @return: returns a C{list} of those local folder names that are mounted within X2Go session <session_uuid>. @rtype: C{list} @@ -2031,11 +2027,10 @@ class X2GoClient(object): @param profile_name: the profile name that we query the master session of @type profile_name: C{str} - @param return_object: return L{X2GoSession} instance + @param return_object: return L{X2GoSession} instance (Default value = True) @type return_object: C{bool} - @param return_session_name: return X2Go session name + @param return_session_name: return X2Go session name (Default value = False) @type return_session_name: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -2053,15 +2048,14 @@ class X2GoClient(object): """\ Retrieve a list of X2Go sessions that this L{X2GoClient} instance is connected to. - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_profile_names: return as list of session profile names + @param return_profile_names: return as list of session profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of session profile IDs + @param return_profile_ids: return as list of session profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of connected sessions @rtype: C{list} @@ -2074,6 +2068,7 @@ class X2GoClient(object): """\ Equals C{True} if there are any connected sessions with this L{X2GoClient} instance. + """ return self.session_registry.has_connected_sessions __client_has_connected_sessions = client_has_connected_sessions @@ -2082,15 +2077,14 @@ class X2GoClient(object): """\ Retrieve a list of X2Go sessions associated to this L{X2GoClient} instance. - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_profile_names: return as list of session profile names + @param return_profile_names: return as list of session profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of session profile IDs + @param return_profile_ids: return as list of session profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of associated sessions @rtype: C{list} @@ -2103,6 +2097,7 @@ class X2GoClient(object): """\ Equals C{True} if there are any associated sessions with this L{X2GoClient} instance. + """ return self.session_registry.has_associated_sessions __client_has_associated_sessions = client_has_associated_sessions @@ -2111,15 +2106,14 @@ class X2GoClient(object): """\ Retrieve a list of running X2Go sessions. - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_profile_names: return as list of session profile names + @param return_profile_names: return as list of session profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of session profile IDs + @param return_profile_ids: return as list of session profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of running sessions @rtype: C{list} @@ -2132,6 +2126,7 @@ class X2GoClient(object): """\ Equals C{True} if there are any running sessions with this L{X2GoClient} instance. + """ return self.session_registry.has_running_sessions __client_has_running_sessions = client_has_running_sessions @@ -2140,15 +2135,14 @@ class X2GoClient(object): """\ Retrieve a list of suspended X2Go sessions. - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_profile_names: return as list of session profile names + @param return_profile_names: return as list of session profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of session profile IDs + @param return_profile_ids: return as list of session profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of suspended sessions @rtype: C{list} @@ -2161,6 +2155,7 @@ class X2GoClient(object): """\ Equals C{True} if there are any suspended sessions with this L{X2GoClient} instance. + """ return self.session_registry.has_suspended_sessions __client_has_suspended_sessions = client_has_suspended_sessions @@ -2169,15 +2164,14 @@ class X2GoClient(object): """\ Retrieve a list of registered X2Go sessions. - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of session profile names + @param return_profile_names: return as list of session profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of session profile IDs + @param return_profile_ids: return as list of session profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of registered sessions @rtype: C{list} @@ -2190,6 +2184,7 @@ class X2GoClient(object): """\ Equals a list of all registered X2Go control sessions. + """ return self.session_registry.control_sessions __client_control_sessions = client_control_sessions @@ -2200,7 +2195,6 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @return: control session instance @rtype: C{X2GoControlSession} instance @@ -2215,14 +2209,12 @@ class X2GoClient(object): @param profile_name: use the control session of this profile to query the X2Go server for its component list @type profile_name: C{str} - @param component: only return the version of a specific component + @param component: only return the version of a specific component (Default value = None) @type component: C{str} - @param force: refresh component/version data by a query to the server + @param force: refresh component/version data by a query to the server (Default value = False) @type force: C{bool} - @return: dictionary of server components (as keys) and their versions (as values) or the version of the given <component> @rtype: C{dict} or C{str} - @raise X2GoClientException: if component is not available on the X2Go Server. """ @@ -2245,9 +2237,8 @@ class X2GoClient(object): @param profile_name: use the control session of this profile to query the X2Go server for its feature list @type profile_name: C{str} - @param force: refresh feature list by a query to the server + @param force: refresh feature list by a query to the server (Default value = False) @type force: C{bool} - @return: list of server feature names (as returned by server-side command ,,x2gofeaturelist'' @rtype: C{list} @@ -2265,7 +2256,6 @@ class X2GoClient(object): @type profile_name: C{str} @param feature: test the availability of this feature on the X2Go server @type feature: C{str} - @return: C{True} if the feature is available on the queried server @rtype: C{bool} @@ -2280,7 +2270,8 @@ class X2GoClient(object): @param session_name: session name @type session_name: C{str} - + @param return_object: return as X2Go session object (Default value = False) + @type return_object: C{bool} @return: session instance of the given name @rtype: C{X2GoSession} or C{str} @@ -2294,7 +2285,6 @@ class X2GoClient(object): @param session_name: session name @type session_name: C{str} - @return: C{True} if the given session is registered @rtype: C{bool} @@ -2308,11 +2298,10 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of registered sessions of profile name @rtype: C{list} @@ -2326,11 +2315,10 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of connected sessions of profile name @rtype: C{list} @@ -2344,11 +2332,10 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of associated sessions of profile name @rtype: C{list} @@ -2362,11 +2349,10 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of application publishing sessions of profile name @rtype: C{list} @@ -2381,11 +2367,10 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of running sessions of profile name @rtype: C{list} @@ -2399,11 +2384,10 @@ class X2GoClient(object): @param profile_name: profile name @type profile_name: C{str} - @param return_objects: return as list of X2Go session objects + @param return_objects: return as list of X2Go session objects (Default value = False) @type return_objects: C{bool} - @param return_session_names: return as list of session names + @param return_session_names: return as list of session names (Default value = False) @type return_session_names: C{bool} - @return: list of suspended sessions of profile name @rtype: C{list} @@ -2423,10 +2407,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: C{True} if X2Go server connection for L{X2GoSession} instance with <session_uuid> is alive. @rtype: C{bool} - @raise X2GoControlSessionException: if the session is not connected anymore; in that case the L{HOOK_on_control_session_death} gets called. """ @@ -2443,6 +2425,7 @@ class X2GoClient(object): """\ Test vitality of all connected X2Go servers. + @return: C{True} if all connected X2Go servers are alive. @rtype: C{bool} @@ -2459,9 +2442,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param username: user name to test validity for + @param username: user name to test validity for (Default value = None) @type username: C{str} - @return: Is remote user allowed to start an X2Go session? @rtype: C{str} @@ -2476,10 +2458,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: list of session names @rtype: C{list} - @raise X2GoClientException: if the session with UUID C{session_uuid} is not connected """ @@ -2523,10 +2503,8 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: list of session names @rtype: C{list} - @raise X2GoClientException: if the session with UUID C{session_uuid} is not connected """ @@ -2580,7 +2558,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} @param published_applications: if C{True}, also terminate sessions that are published applications - provider + provider (Default value = False) @type published_applications: C{bool} """ @@ -2609,26 +2587,25 @@ class X2GoClient(object): a real X2Go session window on the remote server) and connect to this session (with L{X2GoClient.connect_session()}. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} - @param profile_name: use profile name instead of <session_uuid> + @param profile_name: use profile name instead of <session_uuid> (Default value = None) @type profile_name: C{str} - @param profile_id: use profile id instead of <profile_name> or <session_uuid> + @param profile_id: use profile id instead of <profile_name> or <session_uuid> (Default value = None) @type profile_id: C{str} - @param no_cache: do not get the session list from cache, query the X2Go server directly + @param no_cache: do not get the session list from cache, query the X2Go server directly (Default value = False) @type no_cache: C{bool} @param refresh_cache: query the X2Go server directly and update the session list cache - with the new information + with the new information (Default value = False) @type refresh_cache: C{bool} @param update_sessionregistry: query the X2Go server directly and update the - session registry according to the obtained information + session registry according to the obtained information (Default value = True) @type update_sessionregistry: C{bool} @param register_sessions: query the X2Go server directly and register newly found X2Go session - as L{X2GoSession} instances associated to this L{X2GoClient} instance + as L{X2GoSession} instances associated to this L{X2GoClient} instance (Default value = False) @type register_sessions: C{bool} - @param raw: output the session list in X2Go's raw C{x2golistsessions} format + @param raw: output the session list in X2Go's raw C{x2golistsessions} format (Default value = False) @type raw: C{bool} - @raise X2GoClientException: if the session profile specified by C{session_uuid}, C{profile_name} or C{profile_id} is not connected or if none of the named parameters has been specified @@ -2691,27 +2668,25 @@ class X2GoClient(object): a real X2Go session window on the remote server) and connect to this session (with L{X2GoClient.connect_session()}. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} - @param profile_name: use profile name instead of <session_uuid> + @param profile_name: use profile name instead of <session_uuid> (Default value = None) @type profile_name: C{str} - @param profile_id: use profile id instead of <profile_name> or <session_uuid> + @param profile_id: use profile id instead of <profile_name> or <session_uuid> (Default value = None) @type profile_id: C{str} - @param no_cache: do not get the desktop list from cache, query the X2Go server directly + @param no_cache: do not get the desktop list from cache, query the X2Go server directly (Default value = False) @type no_cache: C{bool} @param refresh_cache: query the X2Go server directly and update the desktop list cache - with the new information + with the new information (Default value = False) @type refresh_cache: C{bool} @param exclude_session_types: session types (e.g. "D", "R", "S" or "P") to be excluded from the returned list of sharable desktops (this only works for sharing someone's own sessions, for - sharing other users' sessions, the X2Go Desktop Sharing decides on what is sharable and what not). + sharing other users' sessions, the X2Go Desktop Sharing decides on what is sharable and what not). (Default value = []) @type exclude_session_types: C{list} - @param raw: output the session list in X2Go's raw C{x2golistdesktops} format + @param raw: output the session list in X2Go's raw C{x2golistdesktops} format (Default value = False) @type raw: C{bool} - @return: a list of available desktops to be shared @rtype: C{list} - @raise X2GoClientException: if the session profile specified by C{session_uuid}, C{profile_name} or C{profile_id} is not connected or if none of the named parameters has been specified @@ -2767,17 +2742,17 @@ class X2GoClient(object): def list_mounts_by_profile_name(self, profile_name, no_cache=False, refresh_cache=False, raw=False): - """ + """\ For a given profil C{profile_name} to retrieve its list of mounted client shares for that session. @param profile_name: a valid profile name @type profile_name: C{str} - @param no_cache: do not get the session list from cache, query the X2Go server directly + @param no_cache: do not get the session list from cache, query the X2Go server directly (Default value = False) @type no_cache: C{bool} - @param raw: output the session list in X2Go's raw C{x2golistmounts} format + @param raw: output the session list in X2Go's raw C{x2golistmounts} format (Default value = False) @type raw: C{bool} - + @param refresh_cache: (Default value = False) @return: list of server-side mounted shares for a given profile name @rtype: C{list} @@ -2804,11 +2779,11 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param no_cache: do not get the session list from cache, query the X2Go server directly + @param no_cache: do not get the session list from cache, query the X2Go server directly (Default value = False) @type no_cache: C{bool} - @param raw: output the session list in X2Go's raw C{x2golistmounts} format + @param raw: output the session list in X2Go's raw C{x2golistmounts} format (Default value = False) @type raw: C{bool} - + @param refresh_cache: (Default value = False) @return: list of server-side mounted shares for a given session UUID @rtype: C{list} @@ -2838,8 +2813,9 @@ class X2GoClient(object): configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2Go based application. - return: returns the client's session profiles instance - rtype: C{X2GoSessionProfiles*} instance + + @return: a C{X2GoSessionProfiles*} instance + @rtype: C{obj} """ return self.session_profiles @@ -2852,6 +2828,7 @@ class X2GoClient(object): """\ Equals a list of all profile names that are known to this L{X2GoClient} instance. + """ return self.session_profiles.profile_names __profile_names = profile_names @@ -2864,8 +2841,9 @@ class X2GoClient(object): configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2Go based application. - return: returns the client's settings configuration node - rtype: C{bool} + + @return: a C{X2GoClientSettings*} instance + @rtype: C{obj} """ return self.client_settings @@ -2879,8 +2857,9 @@ class X2GoClient(object): configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2Go based application. - return: returns the client's printing configuration node - rtype: C{bool} + + @return: a C{X2GoClientPrinting*} instance + @rtype: C{bool} """ return self.client_printing @@ -2898,9 +2877,8 @@ class X2GoClient(object): @param profile_id_or_name: name or id of an X2Go session profile as found in the sessions configuration file @type profile_id_or_name: C{str} - @param parameter: if specified, only the value for the given parameter is returned + @param parameter: if specified, only the value for the given parameter is returned (Default value = None) @type parameter: C{str} - @return: a Python dictionary with session profile options @rtype: C{dict} or C{bool}, C{int}, C{str} @@ -2920,7 +2898,6 @@ class X2GoClient(object): @type parameter: C{str} @param value: set this value for the given C{parameter} @type value: C{bool}, C{int}, C{str}, C{list} or C{dict} - @return: returns C{True} if this operation has been successful @rtype: C{dict} @@ -2937,7 +2914,6 @@ class X2GoClient(object): @param profile_name: the session profile name @type profile_name: C{str} - @return: the session profile's ID @rtype: C{str} @@ -2952,7 +2928,6 @@ class X2GoClient(object): @param profile_id: the session profile ID @type profile_id: C{str} - @return: the session profile's name @rtype: C{str} @@ -2967,7 +2942,6 @@ class X2GoClient(object): @param profile_name: a profile name @type profile_name: C{str} - @return: the profile's meta type @rtype: C{str} @@ -2979,7 +2953,7 @@ class X2GoClient(object): """\ Retrieve a list of session profiles that are currently connected to an X2Go server. - @param return_profile_names: return as list of session profile names + @param return_profile_names: return as list of session profile names (Default value = False) @type return_profile_names: C{bool} @return: a list of profile names or IDs @rtype: C{list} @@ -3025,7 +2999,7 @@ class X2GoClient(object): @param profile_name: the X2Go session profile name @type profile_name: C{str} - @param session_list: a manually passed on list of X2Go sessions + @param session_list: a manually passed on list of X2Go sessions (Default value = None) @type session_list: C{X2GoServerList*} instances """ @@ -3061,6 +3035,7 @@ class X2GoClient(object): """\ Update the session registry stati of all session profiles. + """ for profile_name in self.client_connected_profiles(return_profile_names=True): self.__update_sessionregistry_status_by_profile_name(profile_name) @@ -3073,7 +3048,7 @@ class X2GoClient(object): @param profile_name: the X2Go session profile name @type profile_name: C{str} - @param cache_types: specify what cache type to update (available: C{sessions}, C{desktops}, C{mounts}) + @param cache_types: specify what cache type to update (available: C{sessions}, C{desktops}, C{mounts}) (Default value = ('sessions') @type cache_types: C{tuple} or C{list} @param update_sessions: instead of giving a list of cache types, plainly say C{True} here, if you want to update sessions in the session list cache. @@ -3105,7 +3080,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param cache_types: specify what cache type to update (available: C{sessions}, C{desktops}, C{mounts}) + @param cache_types: specify what cache type to update (available: C{sessions}, C{desktops}, C{mounts}) (Default value = ('sessions') @type cache_types: C{tuple} or C{list} @param update_sessions: instead of giving a list of cache types, plainly say C{True} here, if you want to update sessions in the session list cache. @@ -3131,7 +3106,7 @@ class X2GoClient(object): """\ Update the session list cache of all session profiles. - @param cache_types: specify what cache type to update (available: C{sessions}, C{desktops}, C{mounts}) + @param cache_types: specify what cache type to update (available: C{sessions}, C{desktops}, C{mounts}) (Default value = ('sessions') @type cache_types: C{tuple} or C{list} @param update_sessions: instead of giving a list of cache types, plainly say C{True} here, if you want to update sessions in the session list cache. @@ -3165,9 +3140,9 @@ class X2GoClient(object): @param profile_name: the X2Go session profile name @type profile_name: C{str} - @param re_register: re-register available sessions, needs to be done after session profile changes + @param re_register: re-register available sessions, needs to be done after session profile changes (Default value = False) @type re_register: C{bool} - @param skip_pubapp_sessions: Do not auto-register published applications sessions. + @param skip_pubapp_sessions: Do not auto-register published applications sessions. (Default value = False) @type skip_pubapp_sessions: C{bool} """ @@ -3193,7 +3168,7 @@ class X2GoClient(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @param skip_pubapp_sessions: Do not auto-register published applications sessions. + @param skip_pubapp_sessions: Do not auto-register published applications sessions. (Default value = False) @type skip_pubapp_sessions: C{bool} """ @@ -3205,7 +3180,7 @@ class X2GoClient(object): """\ Register all available sessions found on an X2Go server for each session profile. - @param skip_pubapp_sessions: Do not auto-register published applications sessions. + @param skip_pubapp_sessions: Do not auto-register published applications sessions. (Default value = False) @type skip_pubapp_sessions: C{bool} """ diff --git a/x2go/forward.py b/x2go/forward.py index 4f02fba..39f52ef 100644 --- a/x2go/forward.py +++ b/x2go/forward.py @@ -45,6 +45,7 @@ class X2GoFwServer(StreamServer): An L{X2GoFwServer} class object is used to tunnel graphical trafic through an external proxy command launched by a C{X2GoProxy*} backend. + """ def __init__ (self, listener, remote_host, remote_port, @@ -180,6 +181,7 @@ class X2GoFwServer(StreamServer): """\ Close an open channel again. + """ #if self.chan is not None and _X2GOCLIENT_OS != "Windows": if self.chan is not None: @@ -194,6 +196,7 @@ class X2GoFwServer(StreamServer): """\ Close the forwarding tunnel's socket again. + """ _success = False _count = 0 @@ -218,6 +221,7 @@ class X2GoFwServer(StreamServer): """\ Stop the forwarding tunnel. + """ self.is_active = False self.close_socket() @@ -236,25 +240,24 @@ def start_forward_tunnel(local_host='127.0.0.1', local_port=22022, The tunnel is used to transport X2Go graphics data through a proxy application like nxproxy. - @param local_host: local starting point of the forwarding tunnel + @param local_host: local starting point of the forwarding tunnel (Default value = '127.0.0.1') @type local_host: C{int} - @param local_port: listen port of the local starting point + @param local_port: listen port of the local starting point (Default value = 22022) @type local_port: C{int} - @param remote_host: from the endpoint of the tunnel, connect to host C{<remote_host>}... + @param remote_host: from the endpoint of the tunnel, connect to host C{<remote_host>}... (Default value = '127.0.0.1') @type remote_host: C{str} - @param remote_port: ... on port C{<remote_port>} + @param remote_port: on port C{<remote_port>} (Default value = 22) @type remote_port: C{int} - @param ssh_transport: the Paramiko/SSH transport (i.e. the X2Go session's Paramiko/SSH transport object) + @param ssh_transport: the Paramiko/SSH transport (i.e. the X2Go session's Paramiko/SSH transport object) (Default value = None) @type ssh_transport: C{obj} - @param session_instance: the L{X2GoSession} instance that initiates this tunnel + @param session_instance: the L{X2GoSession} instance that initiates this tunnel (Default value = None) @type session_instance: C{obj} - @param session_name: the session name of the X2Go session this port forwarding server belongs to + @param session_name: the session name of the X2Go session this port forwarding server belongs to (Default value = None) @type session_name: C{str} - @param subsystem: a custom string with a component name that tries to evoke a new tunnel setup + @param subsystem: a custom string with a component name that tries to evoke a new tunnel setup (Default value = None) @type subsystem: C{str} - @param logger: an X2GoLogger object + @param logger: an X2GoLogger object (Default value = None) @type logger: C{obj} - @return: returns an L{X2GoFwServer} instance @rtype: C{obj} diff --git a/x2go/guardian.py b/x2go/guardian.py index e645b38..14928cd 100644 --- a/x2go/guardian.py +++ b/x2go/guardian.py @@ -46,6 +46,7 @@ class X2GoSessionGuardian(threading.Thread): There is one L{X2GoSessionGuardian} for each L{X2GoClient} instance (thus: for normal setups there should be _one_ L{X2GoClient} and _one_ L{X2GoSessionGuardian} in use). + """ def __init__(self, client_instance, auto_update_listsessions_cache=False, @@ -102,6 +103,7 @@ class X2GoSessionGuardian(threading.Thread): """\ The handler of this L{X2GoSessionGuardian} thread. + """ seconds = 0 self._keepalive = True @@ -137,6 +139,7 @@ class X2GoSessionGuardian(threading.Thread): """\ Stop this L{X2GoSessionGuardian} thread. + """ self._keepalive = False diff --git a/x2go/inifiles.py b/x2go/inifiles.py index 81d7700..61179b0 100644 --- a/x2go/inifiles.py +++ b/x2go/inifiles.py @@ -48,7 +48,7 @@ from . import log from . import utils class X2GoIniFile(object): - """ + """\ Base class for processing the different ini files used by X2Go clients. Primarily used to standardize the content of the different X2Go client ini file (settings, printing, sessions, xconfig). @@ -57,6 +57,7 @@ class X2GoIniFile(object): default values (as hard coded in Python X2Go), so the resulting objects always contain the same fields. + """ def __init__(self, config_files, defaults=None, logger=None, loglevel=log.loglevel_DEFAULT): @@ -121,6 +122,7 @@ class X2GoIniFile(object): """\ R(e-r)ead configuration file(s). + """ self.logger('proposed config files are %s' % self.config_files, loglevel=log.loglevel_INFO, ) _found_config_files = self.iniConfig.read(self.config_files) @@ -174,6 +176,7 @@ class X2GoIniFile(object): object is held in RAM. No configuration file is affected by this method. + """ for section, sectionvalue in list(self.defaultValues.items()): for key, value in list(sectionvalue.items()): @@ -208,7 +211,9 @@ class X2GoIniFile(object): For writing the first of the C{config_files} specified on instance construction that is writable will be used. + @return: C{True} if the user config file has been successfully written, C{False} otherwise. + @rtype: C{bool} """ @@ -233,7 +238,6 @@ class X2GoIniFile(object): @type section: C{str} @param key: the ini file key in the given section @type key: C{str} - @return: a Python variable type @rtype: class @@ -248,7 +252,8 @@ class X2GoIniFile(object): @type section: C{str} @param key: the ini file key in the given section @type key: C{str} - + @param key_type: Python data type of the given key (Default value = None) + @type: a valid Python type @return: the value for the given section and key @rtype: class @@ -281,6 +286,7 @@ class X2GoIniFile(object): """\ Returns a printable configuration file as a multi-line string. + """ stdout = io.StringIO() self.iniConfig.write(stdout) diff --git a/x2go/log.py b/x2go/log.py index e29e75a..aacc742 100644 --- a/x2go/log.py +++ b/x2go/log.py @@ -52,6 +52,7 @@ class X2GoLogger(object): """\ A simple logger class, that is used by all Python X2Go classes. + """ name = '' tag = '' @@ -88,9 +89,9 @@ class X2GoLogger(object): @param msg: log message text @type msg: C{str} - @param loglevel: log level of this message + @param loglevel: log level of this message (Default value = loglevel_NONE) @type loglevel: C{int} - @param tag: additional tag for this log entry + @param tag: additional tag for this log entry (Default value = None) @type tag: C{str} """ @@ -111,7 +112,9 @@ class X2GoLogger(object): """\ Get the current loglevel. + @return: current log level + @rtype: C{int} """ @@ -121,7 +124,7 @@ class X2GoLogger(object): """\ Set log level by name. - @param loglevel_name: name of loglevel to be set + @param loglevel_name: name of loglevel to be set (Default value = 'none') @type loglevel_name: C{str} """ @@ -137,6 +140,7 @@ class X2GoLogger(object): """\ Silence logging completely. + """ self.loglevel = 0 @@ -144,6 +148,7 @@ class X2GoLogger(object): """\ Set log level to I{ERROR}. + """ self.loglevel = loglevel_ERROR @@ -151,6 +156,7 @@ class X2GoLogger(object): """\ Set log level to I{WARN}. + """ self.loglevel = loglevel_ERROR | loglevel_WARN @@ -158,6 +164,7 @@ class X2GoLogger(object): """\ Set log level to I{NOTICE} (default). + """ self.loglevel = loglevel_ERROR | loglevel_WARN | loglevel_NOTICE @@ -165,6 +172,7 @@ class X2GoLogger(object): """\ Set log level to I{INFO}. + """ self.loglevel = loglevel_ERROR | loglevel_WARN | loglevel_NOTICE | loglevel_INFO @@ -172,6 +180,7 @@ class X2GoLogger(object): """\ Set log level to I{DEBUG}. + """ self.loglevel = loglevel_ERROR | loglevel_WARN | loglevel_NOTICE | loglevel_INFO | loglevel_DEBUG @@ -179,6 +188,7 @@ class X2GoLogger(object): """\ Additionally, switch on sFTP data transfer debugging + """ self.loglevel = self.loglevel | loglevel_DEBUG_SFTPXFER @@ -186,6 +196,7 @@ class X2GoLogger(object): """\ Switch off sFTP data transfer debugging. + """ self.loglevel = self.loglevel ^ loglevel_DEBUG_SFTPXFER diff --git a/x2go/mimebox.py b/x2go/mimebox.py index 63b758e..2378dc5 100644 --- a/x2go/mimebox.py +++ b/x2go/mimebox.py @@ -52,6 +52,7 @@ class X2GoMIMEboxQueue(threading.Thread): directory. The actual handling of a dropped file is handled by the classes L{X2GoMIMEboxActionOPEN}, L{X2GoMIMEboxActionOPENWITH} and L{X2GoMIMEboxActionSAVEAS}. + """ mimebox_action = None @@ -121,6 +122,7 @@ class X2GoMIMEboxQueue(threading.Thread): Prevent acceptance of new incoming files. The processing of MIME box jobs that are currently still active will be completed, though. + """ if self._accept_jobs == True: self._accept_jobs = False @@ -131,6 +133,7 @@ class X2GoMIMEboxQueue(threading.Thread): Resume operation of the X2Go MIME box queue and continue accepting new incoming files. + """ if self._accept_jobs == False: self._accept_jobs = True @@ -140,6 +143,7 @@ class X2GoMIMEboxQueue(threading.Thread): """\ Stops this L{X2GoMIMEboxQueue} thread completely. + """ self.pause() self._keepalive = False @@ -180,6 +184,7 @@ class X2GoMIMEboxQueue(threading.Thread): """\ This method gets called once the L{X2GoMIMEboxQueue} thread is started by the C{X2GoMIMEboxQueue.start()} method. + """ self.logger('starting MIME box queue thread: %s' % repr(self), loglevel=log.loglevel_DEBUG) @@ -217,13 +222,15 @@ def x2go_mimeboxjob_handler(mimebox_file=None, This function is called as a handler function for each incoming X2Go MIME box file represented by the class L{X2GoMIMEboxJob}. - @param mimebox_file: MIME box file name as placed in to the X2Go MIME box spool directory + @param mimebox_file: MIME box file name as placed in to the X2Go MIME box spool directory (Default value = None) @type mimebox_file: C{str} - @param mimebox_action: an instance of either of the possible C{X2GoMIMEboxActionXXX} classes + @param mimebox_action: an instance of either of the possible C{X2GoMIMEboxActionXXX} classes (Default value = None) @type mimebox_action: C{X2GoMIMEboxActionXXX} nstance - @param parent_thread: the L{X2GoMIMEboxQueue} thread that actually created this handler's L{X2GoMIMEboxJob} instance + @param mimebox_extensions: filter out files whose file extension is not in this list (Default value = [], means: no filtering) + @type mimebox_extensions: C{list} + @param parent_thread: the L{X2GoMIMEboxQueue} thread that actually created this handler's L{X2GoMIMEboxJob} instance (Default value = None) @type parent_thread: C{obj} - @param logger: the L{X2GoMIMEboxQueue}'s logging instance + @param logger: the L{X2GoMIMEboxQueue}'s logging instance (Default value = None) @type logger: C{obj} """ @@ -267,6 +274,7 @@ class X2GoMIMEboxJob(threading.Thread): As a handler for this class the function L{x2go_mimeboxjob_handler()} is used. + """ def __init__(self, **kwargs): """\ diff --git a/x2go/mimeboxactions.py b/x2go/mimeboxactions.py index 7db3bac..3d93ae2 100644 --- a/x2go/mimeboxactions.py +++ b/x2go/mimeboxactions.py @@ -87,6 +87,9 @@ class X2GoMIMEboxAction(object): """\ Return the X2Go MIME box action's name. + @return: MIME box action name + @rtype: C{str} + """ return self.__name__ @@ -95,6 +98,9 @@ class X2GoMIMEboxAction(object): """\ Return the X2Go MIME box action's description text. + @return: MIME box action's description + @rtype: C{str} + """ return self.__description__ @@ -131,6 +137,7 @@ class X2GoMIMEboxActionOPEN(X2GoMIMEboxAction): """\ MIME box action that opens incoming files in the system's default application. + """ __name__= 'OPEN' __decription__= 'Open incoming file with local system\'s default application.' @@ -189,6 +196,7 @@ class X2GoMIMEboxActionOPENWITH(X2GoMIMEboxAction): MIME box action that calls the system's ,,Open with...'' dialog on incoming files. Currently only properly implementable on Windows platforms. + """ __name__= 'OPENWITH' __decription__= 'Evoke ,,Open with...\'\' dialog on incoming MIME box files.' @@ -247,6 +255,7 @@ class X2GoMIMEboxActionSAVEAS(X2GoMIMEboxAction): can be hi-jacked by one of your application's methods which then can handle the ,,Save as...'' request. + """ __name__ = 'SAVEAS' __decription__= 'Save incoming file as...' diff --git a/x2go/printactions.py b/x2go/printactions.py index 83099d3..5426cdf 100644 --- a/x2go/printactions.py +++ b/x2go/printactions.py @@ -96,6 +96,9 @@ class X2GoPrintAction(object): """\ Return the X2Go print action's name. + @return: print action name + @rtype: C{str} + """ return self.__name__ @@ -104,11 +107,14 @@ class X2GoPrintAction(object): """\ Return the X2Go print action's description text. + @return: print action's description + @rtype: C{str} + """ return self.__description__ def _do_print(self, pdf_file, job_title, spool_dir, ): - """ + """\ Perform the defined print action (doing nothing in L{X2GoPrintAction} parent class). @param pdf_file: PDF file name as placed in to the X2Go spool directory @@ -167,6 +173,7 @@ class X2GoPrintActionPDFVIEW(X2GoPrintAction): """\ Print action that views incoming print job in an external PDF viewer application. + """ __name__= 'PDFVIEW' __decription__= 'View as PDF document' @@ -202,7 +209,6 @@ class X2GoPrintActionPDFVIEW(X2GoPrintAction): @type job_title: C{str} @param spool_dir: location of the X2Go client's spool directory @type spool_dir: C{str} - @raise OSError: pass through all C{OSError}s except no. 2 """ @@ -245,6 +251,7 @@ class X2GoPrintActionPDFSAVE(X2GoPrintAction): """\ Print action that saves incoming print jobs to a local folder. + """ __name__ = 'PDFSAVE' __decription__= 'Save as PDF' @@ -302,6 +309,7 @@ class X2GoPrintActionPRINT(X2GoPrintAction): """\ Print action that actually prints an incoming print job file. + """ __name__ = 'PRINT' __decription__= 'UNIX/Win32GDI printing' @@ -431,6 +439,7 @@ class X2GoPrintActionPRINTCMD(X2GoPrintAction): The print job's PDF filename will be prepended as last argument to the print command used in L{X2GoPrintActionPRINTCMD} instances. + """ __name__ = 'PRINTCMD' __decription__= 'Print via a command (like LPR)' @@ -491,6 +500,7 @@ class X2GoPrintActionDIALOG(X2GoPrintAction): the actual print dialog box must be implemented in our GUI application (with the application's L{X2GoClient} instance. + """ __name__ = 'DIALOG' __decription__= 'Open a print dialog box' diff --git a/x2go/printqueue.py b/x2go/printqueue.py index d2c67d7..be24e13 100644 --- a/x2go/printqueue.py +++ b/x2go/printqueue.py @@ -49,6 +49,7 @@ class X2GoPrintQueue(threading.Thread): If X2Go printing is supported in a particular L{X2GoSession} instance this class provides a sub-thread for handling incoming X2Go print jobs. + """ print_action = None @@ -119,6 +120,7 @@ class X2GoPrintQueue(threading.Thread): Prevent acceptance of new incoming print jobs. The processing of print jobs that are currently still active will be completed, though. + """ if self._accept_jobs == True: self._accept_jobs = False @@ -129,6 +131,7 @@ class X2GoPrintQueue(threading.Thread): Resume operation of the X2Go print spooler and continue accepting new incoming print jobs. + """ if self._accept_jobs == False: self._accept_jobs = True @@ -138,6 +141,7 @@ class X2GoPrintQueue(threading.Thread): """\ Stops this L{X2GoPrintQueue} thread completely. + """ self.pause() self._keepalive = False @@ -189,6 +193,7 @@ class X2GoPrintQueue(threading.Thread): """\ Start this L{X2GoPrintQueue} thread... + """ self.logger('starting print queue thread: %s' % repr(self), loglevel=log.loglevel_DEBUG) @@ -228,15 +233,17 @@ def x2go_printjob_handler(job_file=None, pdf_file=None, job_title=None, print_ac explicit C{print_action} is passed to this function...). It then will execute the C{<print_action>.do_print()} command. - @param pdf_file: PDF file name as placed in to the X2Go spool directory + @param job_file: file name of this print job's Job File (Default value = None) + @type job_file: C{str} + @param pdf_file: PDF file name as placed in to the X2Go spool directory (Default value = None) @type pdf_file: C{str} - @param job_title: human readable print job title + @param job_title: human readable print job title (Default value = None) @type job_title: C{str} - @param print_action: an instance of either of the possible C{X2GoPrintActionXXX} classes + @param print_action: an instance of either of the possible C{X2GoPrintActionXXX} classes (Default value = None) @type print_action: C{X2GoPrintActionXXX} nstance - @param parent_thread: the L{X2GoPrintQueue} thread that actually created this handler's L{X2GoPrintJob} instance + @param parent_thread: the L{X2GoPrintQueue} thread that actually created this handler's L{X2GoPrintJob} instance (Default value = None) @type parent_thread: C{obj} - @param logger: the L{X2GoPrintQueue}'s logging instance + @param logger: the L{X2GoPrintQueue}'s logging instance (Default value = None) @type logger: C{obj} """ @@ -285,6 +292,7 @@ class X2GoPrintJob(threading.Thread): As a handler for this class the function L{x2go_printjob_handler()} is used. + """ def __init__(self, **kwargs): """\ diff --git a/x2go/pulseaudio.py b/x2go/pulseaudio.py index 27e5755..e7d2d5a 100644 --- a/x2go/pulseaudio.py +++ b/x2go/pulseaudio.py @@ -54,9 +54,7 @@ class OSNotSupportedException(exceptions.Exception): pass """ Exception denoting that this operating system is not supported. """ class X2GoPulseAudio(threading.Thread): - """ - This class controls the Pulse Audio daemon. - """ + """This class controls the Pulse Audio daemon.""" def __init__(self, path=None, client_instance=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @@ -97,6 +95,7 @@ class X2GoPulseAudio(threading.Thread): This method is called once the C{X2GoPulseAudio.start()} method has been called. To tear down the Pulseaudio daemon call the L{X2GoPulseAudio.stop_thread()} method. + """ self._keepalive = True cmd = 'pulseaudio.exe' @@ -177,6 +176,7 @@ class X2GoPulseAudio(threading.Thread): """\ Tear down a running Pulseaudio daemon. + """ self.logger('stop_thread() method has been called', loglevel=log.loglevel_DEBUG) self._keepalive = False diff --git a/x2go/registry.py b/x2go/registry.py index 8f3b7b8..3d5d7ec 100644 --- a/x2go/registry.py +++ b/x2go/registry.py @@ -55,6 +55,7 @@ class X2GoSessionRegistry(object): This class is utilized by L{X2GoClient} instances to maintain a good overview on session status of all associated L{X2GoSession} instances. + """ def __init__(self, client_instance, logger=None, loglevel=log.loglevel_DEFAULT): @@ -88,7 +89,9 @@ class X2GoSessionRegistry(object): """\ A list of session registry keys. + @return: session registry key list + @rtype: C{list} """ @@ -127,6 +130,7 @@ class X2GoSessionRegistry(object): assure that the session registry does not get filled with session UUID duplicates. + """ self._skip_auto_registration = True @@ -135,6 +139,7 @@ class X2GoSessionRegistry(object): This method is used to temporarily (re-)enable auto-registration of newly appearing X2Go session on the server side. + """ self._skip_auto_registration = False @@ -158,7 +163,6 @@ class X2GoSessionRegistry(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: profile ID @rtype: C{str} @@ -171,7 +175,6 @@ class X2GoSessionRegistry(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - @return: profile name @rtype: C{str} @@ -184,7 +187,8 @@ class X2GoSessionRegistry(object): @param session_uuid: the X2Go session's UUID registry hash @type session_uuid: C{str} - + @param status_only: short summary, include session status only (Default value = False) + @type status_only: C{bool} @return: session summary dictionary @rtype: C{dict} @@ -231,23 +235,23 @@ class X2GoSessionRegistry(object): Update the session status for L{X2GoSession} that is represented by a given session UUID hash, profile name or profile ID. - @param session_uuid: the X2Go session's UUID registry hash + @param session_uuid: the X2Go session's UUID registry hash (Default value = None) @type session_uuid: C{str} @param profile_name: alternatively, a profile name can be specified (the stati of all registered sessions for this session - profile will be updated) + profile will be updated) (Default value = None) @type profile_name: C{str} @param profile_id: alternatively, a profile ID can be given (the stati of all registered sessions for this session - profile will be updated) + profile will be updated) (Default value = None) @type profile_id: C{str} @param session_list: an optional C{X2GoServerSessionList*} instance (as returned by the L{X2GoClient.list_sessions()} command can - be passed to this method. + be passed to this method. (Default value = None) @type session_list: C{X2GoServerSessionList*} instance - @param force_update: make sure the session status gets really updated + @param force_update: make sure the session status gets really updated (Default value = False) @type force_update: C{bool} - + @param newly_connected: set this to C{True}, if the control session has just been connected (Default value = False) + @param newly_connected: C{bool} @return: C{True} if this method has been successful @rtype: C{bool} - @raise X2GoSessionRegistryException: if the combination of C{session_uuid}, C{profile_name} and C{profile_id} does not match the requirement: only one of them @@ -387,13 +391,13 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name to register available X2Go sessions for @type profile_name: C{str} @param session_list: an optional C{X2GoServerSessionList*} instance (as returned by the L{X2GoClient.list_sessions()} command can - be passed to this method. + be passed to this method. (Default value = None) @type session_list: C{X2GoServerSessionList*} instance - @param newly_connected: give a hint that the session profile got newly connected + @param newly_connected: give a hint that the session profile got newly connected (Default value = False) @type newly_connected: C{bool} - @param re_register: re-register available sessions, needs to be done after changes to the session profile + @param re_register: re-register available sessions, needs to be done after changes to the session profile (Default value = False) @type re_register: C{bool} - @param skip_pubapp_sessions: Do not register published applications sessions + @param skip_pubapp_sessions: Do not register published applications sessions (Default value = False) @type skip_pubapp_sessions: C{bool} """ @@ -484,21 +488,21 @@ class X2GoSessionRegistry(object): @type profile_id: C{str} @param profile_name: profile name @type profile_name: C{str} - @param session_name: session name (if available) + @param session_name: session name (if available) (Default value = None) @type session_name: C{str} - @param control_backend: X2Go control session backend to use + @param control_backend: X2Go control session backend to use (Default value = _BACKENDS['X2GoControlSession']['default']) @type control_backend: C{str} - @param terminal_backend: X2Go terminal session backend to use + @param terminal_backend: X2Go terminal session backend to use (Default value = _BACKENDS['X2GoTerminalSession']['default']) @type terminal_backend: C{str} - @param info_backend: X2Go session info backend to use + @param info_backend: X2Go session info backend to use (Default value = _BACKENDS['X2GoServerSessionInfo']['default']) @type info_backend: C{str} - @param list_backend: X2Go session list backend to use + @param list_backend: X2Go session list backend to use (Default value = _BACKENDS['X2GoServerSessionList']['default']) @type list_backend: C{str} - @param proxy_backend: X2Go proxy backend to use + @param proxy_backend: X2Go proxy backend to use (Default value = _BACKENDS['X2GoProxy']['default']) @type proxy_backend: C{str} - @param settings_backend: X2Go client settings backend to use + @param settings_backend: X2Go client settings backend to use (Default value = _BACKENDS['X2GoClientSettings']['default']) @type settings_backend: C{str} - @param printing_backend: X2Go client printing backend to use + @param printing_backend: X2Go client printing backend to use (Default value = _BACKENDS['X2GoClientPrinting']['default']) @type printing_backend: C{str} @param client_rootdir: client base dir (default: ~/.x2goclient) @type client_rootdir: C{str} @@ -513,8 +517,7 @@ class X2GoSessionRegistry(object): @param known_hosts: the underlying Paramiko/SSH systems C{known_hosts} file @type known_hosts: C{str} @param kwargs: all other options will be passed on to the constructor of the to-be-instantiated L{X2GoSession} instance - @type C{dict} - + @type kwargs: C{dict} @return: the session UUID of the newly registered (or re-registered) session @rtype: C{str} @@ -612,9 +615,8 @@ class X2GoSessionRegistry(object): @param session_name: name of session to be searched for @type session_name: C{str} - @param match_profile_name: a session's profile_name must match this profile name + @param match_profile_name: a session's profile_name must match this profile name (Default value = None) @type match_profile_name: C{str} - @return: C{True} if a session of C{<session_name>} has been found @rtype: C{bool} @@ -627,14 +629,12 @@ class X2GoSessionRegistry(object): @param session_name: name of session to be retrieved @type session_name: C{str} - @param return_object: if C{False} the session UUID hash will be returned, if C{True} the L{X2GoSession} instance will be returned + @param return_object: if C{False} the session UUID hash will be returned, if C{True} the L{X2GoSession} instance will be returned (Default value = False) @type return_object: C{bool} - @param match_profile_name: returned sessions must match this profile name + @param match_profile_name: returned sessions must match this profile name (Default value = None) @type match_profile_name: C{str} - @return: L{X2GoSession} object or its representing session UUID hash @rtype: L{X2GoSession} instance or C{str} - @raise X2GoSessionRegistryException: if there is more than one L{X2GoSession} registered for C{<session_name>} within the same L{X2GoClient} instance. This should never happen! @@ -690,15 +690,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that the underlying L{X2GoClient} instances is currently connected to. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -710,15 +709,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that are currently associated by an C{X2GoTerminalSession*} to the underlying L{X2GoClient} instance. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -730,15 +728,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that are currently still in virgin state (not yet connected, associated etc.). If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -750,15 +747,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that are currently in running state. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -770,15 +766,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that are currently in suspended state. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -790,15 +785,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that have terminated recently. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -810,6 +804,7 @@ class X2GoSessionRegistry(object): """\ Equals C{True} if the underlying L{X2GoClient} instance has any running sessions at hand. + """ return self.running_sessions() and len(self.running_sessions()) > 0 @@ -818,6 +813,7 @@ class X2GoSessionRegistry(object): """\ Equals C{True} if the underlying L{X2GoClient} instance has any suspended sessions at hand. + """ return self.suspended_sessions and len(self.suspended_sessions) > 0 @@ -826,15 +822,14 @@ class X2GoSessionRegistry(object): Retrieve a list of all registered sessions. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -846,15 +841,14 @@ class X2GoSessionRegistry(object): Retrieve a list of sessions that are currently _NOT_ in running state. If none of the C{return_*} options is specified a list of session UUID hashes will be returned. - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_profile_names: return as list of profile names + @param return_profile_names: return as list of profile names (Default value = False) @type return_profile_names: C{bool} - @param return_profile_ids: return as list of profile IDs + @param return_profile_ids: return as list of profile IDs (Default value = False) @type return_profile_ids: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} @@ -868,11 +862,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -891,11 +884,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -914,11 +906,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -937,11 +928,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -961,11 +951,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -984,11 +973,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -1007,11 +995,10 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @param return_objects: return as list of L{X2GoSession} instances + @param return_objects: return as list of L{X2GoSession} instances (Default value = True) @type return_objects: C{bool} - @param return_session_names: return as list of X2Go session names + @param return_session_names: return as list of X2Go session names (Default value = False) @type return_session_names: C{bool} - @return: a session list (as UUID hashes, objects or session names) @rtype: C{list} @@ -1029,7 +1016,6 @@ class X2GoSessionRegistry(object): @param profile_name: session profile name @type profile_name: C{str} - @return: contol session instance @rtype: C{X2GoControlSession*} instance @@ -1045,6 +1031,7 @@ class X2GoSessionRegistry(object): """\ Equals a list of all currently connected control sessions. + """ return [ c for c in list(self.control_sessions.values()) if c.is_connected() ] @@ -1052,9 +1039,12 @@ class X2GoSessionRegistry(object): """\ Retrieve a list of all currently connected session profiles. - @param use_paramiko: send query directly to the Paramiko/SSH layer + @param use_paramiko: send query directly to the Paramiko/SSH layer (Default value = False) @type use_paramiko: C{bool} - + @param return_profile_names: return as list of profile names (Default value = False) + @type return_profile_names: C{bool} + @param return_profile_ids: return as list of profile IDs (Default value = True) + @type return_profile_ids: C{bool} @return: list of connected session profiles @rtype: C{list} @@ -1070,11 +1060,10 @@ class X2GoSessionRegistry(object): @param profile_name: the profile name that we query the master session of @type profile_name: C{str} - @param return_object: return L{X2GoSession} instance + @param return_object: return L{X2GoSession} instance (Default value = True) @type return_object: C{bool} - @param return_session_name: return X2Go session name + @param return_session_name: return X2Go session name (Default value = False) @type return_session_name: C{bool} - @return: a session list (as UUID hashes, objects, profile names/IDs or session names) @rtype: C{list} diff --git a/x2go/rforward.py b/x2go/rforward.py index b313375..7631236 100644 --- a/x2go/rforward.py +++ b/x2go/rforward.py @@ -40,7 +40,7 @@ from gevent import select, socket, Timeout from . import log -def x2go_transport_tcp_handler(chan, xxx_todo_changeme, xxx_todo_changeme1): +def x2go_transport_tcp_handler(chan, origin, server): """\ An X2Go customized TCP handler for the Paramiko/SSH C{Transport()} class. @@ -56,9 +56,16 @@ def x2go_transport_tcp_handler(chan, xxx_todo_changeme, xxx_todo_changeme1): instance, this instance gets notified of the incoming channel and a new L{X2GoRevFwChannelThread} is started. This L{X2GoRevFwChannelThread} then takes care of the new channel's incoming data stream. + @param chan: a Paramiko channel object + @type chan: C{paramiko.Channel} object + @param origin: host/port tuple where a connection originates from + @type origin: C{tuple} + @param server: host/port tuple where to connect to + @type server: C{tuple} + """ - (origin_addr, origin_port) = xxx_todo_changeme - (server_addr, server_port) = xxx_todo_changeme1 + (origin_addr, origin_port) = origin + (server_addr, server_port) = server transport = chan.get_transport() transport._queue_incoming_channel(chan) rev_tuns = transport.reverse_tunnels @@ -80,6 +87,7 @@ class X2GoRevFwTunnel(threading.Thread): X2Go audio, X2Go printing and X2Go folder sharing / device mounting through Paramiko/SSH. + """ def __init__(self, server_port, remote_host, remote_port, ssh_transport, session_instance=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @@ -162,6 +170,7 @@ class X2GoRevFwTunnel(threading.Thread): reverse forwarding tunnel. Also, any active connection on this L{X2GoRevFwTunnel} instance will be closed immediately, if this method is called. + """ if self._accept_channels == True: self.cancel_port_forward('', self.server_port) @@ -173,6 +182,7 @@ class X2GoRevFwTunnel(threading.Thread): Resume operation of the Paramiko/SSH reverse forwarding tunnel and continue accepting new incoming connections. + """ if self._accept_channels == False: self._accept_channels = True @@ -190,6 +200,7 @@ class X2GoRevFwTunnel(threading.Thread): The sent notification will trigger a C{thread.Condition()} waiting for notification in L{X2GoRevFwTunnel.run()}. + """ self.incoming_channel.acquire() self.logger('notifying thread of incoming channel: %s' % repr(self), loglevel=log.loglevel_DEBUG) @@ -200,6 +211,7 @@ class X2GoRevFwTunnel(threading.Thread): """\ Stops this L{X2GoRevFwTunnel} thread completely. + """ self.pause() self._keepalive = False @@ -242,6 +254,7 @@ class X2GoRevFwTunnel(threading.Thread): until the tunnel gets paused by an L{X2GoRevFwTunnel.pause()} call or stopped via the L{X2GoRevFwTunnel.stop_thread()} method. + """ self._request_port_forwarding() self._keepalive = True @@ -289,16 +302,16 @@ def x2go_rev_forward_channel_handler(chan=None, addr='', port=0, parent_thread=N tunneled SSH connections associated to this L{X2GoRevFwTunnel} instance from within a Python X2Go application. - @param chan: channel + @param chan: channel (Default value = None) @type chan: C{class} - @param addr: bind address + @param addr: bind address (Default value = '') @type addr: C{str} - @param port: bind port + @param port: bind port (Default value = 0) @type port: C{int} - @param parent_thread: the calling L{X2GoRevFwTunnel} instance + @param parent_thread: the calling L{X2GoRevFwTunnel} instance (Default value = None) @type parent_thread: L{X2GoRevFwTunnel} instance @param logger: you can pass an L{X2GoLogger} object to the - L{X2GoRevFwTunnel} constructor + L{X2GoRevFwTunnel} constructor (Default value = None) @type logger: L{X2GoLogger} instance """ @@ -344,6 +357,7 @@ class X2GoRevFwChannelThread(threading.Thread): Starts a thread for each incoming Paramiko/SSH data channel trough the reverse forwarding tunnel. + """ def __init__(self, channel, remote=None, **kwargs): """\ diff --git a/x2go/session.py b/x2go/session.py index 2f79014..9bfb96b 100644 --- a/x2go/session.py +++ b/x2go/session.py @@ -132,6 +132,7 @@ class X2GoSession(object): L{X2GoClient} context (session registry, session list cache, auto-registration of new sessions etc.). + """ def __init__(self, server=None, port=22, control_session=None, use_sshproxy=False, @@ -429,8 +430,8 @@ class X2GoSession(object): """\ Return parent L{X2GoClient} instance if avaiable. - return: L{X2GoClient} instance this session is associated with - rtype: C{obj} + @return: L{X2GoClient} instance this session is associated with + @rtype: C{obj} """ return self.client_instance @@ -440,6 +441,7 @@ class X2GoSession(object): """\ HOOK method: called if a control session (server connection) has unexpectedly encountered a failure. + """ if self.client_instance: self.client_instance.HOOK_on_control_session_death(profile_name=self.profile_name) @@ -450,6 +452,7 @@ class X2GoSession(object): """\ HOOK method: called SFTP client support is unavailable for the session. + """ if self.client_instance: self.client_instance.HOOK_on_failing_SFTP_client(profile_name=self.profile_name) @@ -460,6 +463,7 @@ class X2GoSession(object): """\ HOOK method: called if the session demands to auto connect. + """ if self.client_instance: self.client_instance.HOOK_profile_auto_connect(profile_name=self.profile_name) @@ -470,6 +474,7 @@ class X2GoSession(object): """\ HOOK method: called if the startup of a session failed. + """ if self.client_instance: self.client_instance.HOOK_session_startup_failed(profile_name=self.profile_name) @@ -480,6 +485,7 @@ class X2GoSession(object): """\ HOOK method: called if the startup of a shadow session was denied by the other user. + """ if self.client_instance: self.client_instance.HOOK_desktop_sharing_denied(profile_name=self.profile_name) @@ -490,6 +496,7 @@ class X2GoSession(object): """\ HOOK method: called if the x2golistdesktops command generates a timeout due to long execution time. + """ if self.client_instance: self.client_instance.HOOK_list_desktops_timeout(profile_name=self.profile_name) @@ -500,6 +507,9 @@ class X2GoSession(object): """\ HOOK method: called if it is tried to connect to a shared desktop that's not available (anymore). + @param desktop: the could-not-be-shared desktop's name or other identifier (Default value = 'UNKNOWN') + @type desktop: C{str} + """ if self.client_instance: self.client_instance.HOOK_no_such_desktop(profile_name=self.profile_name, desktop=desktop) @@ -510,7 +520,7 @@ class X2GoSession(object): """\ HOOK method: called if a reverse port forwarding request has been denied. - @param server_port: remote server port (starting point of reverse forwarding tunnel) + @param server_port: remote server port (starting point of reverse forwarding tunnel) (Default value = 0) @type server_port: C{str} """ @@ -523,11 +533,11 @@ class X2GoSession(object): """\ HOOK method: called if a port forwarding tunnel setup failed. - @param chain_host: hostname of chain host (forwarding tunnel end point) + @param chain_host: hostname of chain host (forwarding tunnel end point) (Default value = 'UNKNOWN') @type chain_host: C{str} - @param chain_port: port of chain host (forwarding tunnel end point) + @param chain_port: port of chain host (forwarding tunnel end point) (Default value = 0) @type chain_port: C{str} - @param subsystem: information on the subsystem that provoked this hook call + @param subsystem: information on the subsystem that provoked this hook call (Default value = None) @type subsystem: C{str} """ @@ -548,6 +558,7 @@ class X2GoSession(object): """\ HOOK method: called if X2Go client-side printing is not available. + """ if self.client_instance: self.client_instance.HOOK_printing_not_available(profile_name=self.profile_name, session_name=self.session_name) @@ -558,6 +569,7 @@ class X2GoSession(object): """\ HOOK method: called if the X2Go MIME box is not available. + """ if self.client_instance: self.client_instance.HOOK_mimebox_not_available(profile_name=self.profile_name, session_name=self.session_name) @@ -568,6 +580,7 @@ class X2GoSession(object): """\ HOOK method: called if X2Go client-side folder-sharing is not available. + """ if self.client_instance: self.client_instance.HOOK_foldersharing_not_available(profile_name=self.profile_name, session_name=self.session_name) @@ -578,6 +591,7 @@ class X2GoSession(object): """\ HOOK method: called if the X2Go server denies SSHFS access. + """ if self.client_instance: self.client_instance.HOOK_sshfs_not_available(profile_name=self.profile_name, session_name=self.session_name) @@ -592,9 +606,9 @@ class X2GoSession(object): @type host: C{str} @param port: SSH server port to validate @type port: C{int} - @param fingerprint: the server's fingerprint + @param fingerprint: the server's fingerprint (Default value = 'no fingerprint') @type fingerprint: C{str} - @param fingerprint_type: finger print type (like RSA, DSA, ...) + @param fingerprint_type: finger print type (like RSA, DSA, ...) (Default value = 'UNKNOWN') @type fingerprint_type: C{str} @return: if host validity is verified, this hook method should return C{True} @rtype: C{bool} @@ -610,6 +624,7 @@ class X2GoSession(object): """\ Initialize a new control session (C{X2GoControlSession*}). + """ low_latency = 'link' in self.terminal_params and self.terminal_params['link'].lower() in ('modem', 'isdn') @@ -642,6 +657,7 @@ class X2GoSession(object): If this L{X2GoSession} instance is a standalone instance (without parent L{X2GoClient}) this method will always return C{True}. + @return: returns C{True} if this session is a master session @rtype: C{bool} @@ -659,9 +675,9 @@ class X2GoSession(object): an already set-up terminal session. @param wait: wait for <wait> seconds before sharing local folders via the new master session - of the corresponding session profile. + of the corresponding session profile. (Default value = 0) @type wait: C{int} - @param max_wait: wait for <max_wait> seconds for the terminal session to appear + @param max_wait: wait for <max_wait> seconds for the terminal session to appear (Default value = 20) @type max_wait: C{int} """ @@ -690,6 +706,7 @@ class X2GoSession(object): """\ Declare this as a non-master session of a connection channel. + """ # unmount shared folders if self.has_terminal_session(): @@ -737,10 +754,8 @@ class X2GoSession(object): @param option: name of a specific profile option to be queried. @type option: C{str} - @return: value for profile option C{<option>} @rtype: C{bool,str,int} - @raise X2GoProfileException: if the session profile option is unknown """ @@ -844,6 +859,7 @@ class X2GoSession(object): """\ Retrieve session UUID hash for this L{X2GoSession}. + @return: the session's UUID hash @rtype: C{str} @@ -856,6 +872,7 @@ class X2GoSession(object): After a session has been set up you can query the username the session runs as. + @return: the remote username the X2Go session runs as @rtype: C{str} @@ -872,6 +889,7 @@ class X2GoSession(object): After a session has been set up you can query the remote user's home directory path. + @return: the remote home directory path @rtype: C{str} @@ -887,9 +905,8 @@ class X2GoSession(object): """\ Check if a given user is valid server-side X2Go user. - @param username: username to check validity for + @param username: username to check validity for (Default value = None) @type username: C{str} - @return: C{True} if the username is allowed to launch X2Go sessions @rtype: C{bool} @@ -904,6 +921,7 @@ class X2GoSession(object): After a session has been setup up you can query the username's password from the session. + @return: the username's password @rtype: C{str} @@ -917,6 +935,7 @@ class X2GoSession(object): peername of the host this session is connected to (or about to connect to). + @return: the address of the server the X2Go session is connected to (as an C{(addr,port)} tuple) @rtype: C{tuple} @@ -933,6 +952,7 @@ class X2GoSession(object): hostname of the host this session is connected to (or about to connect to). + @return: the hostname of the server the X2Go session is connected to / about to connect to @rtype: C{str} @@ -947,6 +967,7 @@ class X2GoSession(object): After a session has been setup up you can query the IP socket port used for connecting the remote X2Go server. + @return: the server-side IP socket port that is used by the X2Go session to connect to the server @rtype: C{str} @@ -959,6 +980,7 @@ class X2GoSession(object): """\ Retrieve the server-side X2Go session name for this session. + @return: X2Go session name @rtype: C{str} @@ -981,6 +1003,7 @@ class X2GoSession(object): """\ Retrieve the server-side X2Go session info object for this session. + @return: X2Go session info @rtype: C{obj} @@ -994,6 +1017,7 @@ class X2GoSession(object): Retrieve the server-side command that is used to start a session on the remote X2Go server. + @return: server-side session command @rtype: C{str} @@ -1014,6 +1038,7 @@ class X2GoSession(object): - S: shadow session - P: session in published applications mode + @return: session type @rtype: C{str} @@ -1029,6 +1054,7 @@ class X2GoSession(object): Retrieve the session window title of this session. + @return: session window title @rtype: C{str} @@ -1043,6 +1069,7 @@ class X2GoSession(object): """\ Retrieve the control session (C{X2GoControlSession*} backend) of this L{X2GoSession}. + @return: the L{X2GoSession}'s control session @rtype: C{X2GoControlSession*} instance @@ -1054,6 +1081,7 @@ class X2GoSession(object): """\ Check if this L{X2GoSession} instance has an associated control session. + @return: returns C{True} if this L{X2GoSession} has a control session associated to itself @rtype: C{bool} @@ -1065,6 +1093,7 @@ class X2GoSession(object): """\ Retrieve the terminal session (C{X2GoTerminalSession*} backend) of this L{X2GoSession}. + @return: the L{X2GoSession}'s terminal session @rtype: C{X2GoControlTerminal*} instance @@ -1078,6 +1107,7 @@ class X2GoSession(object): """\ Check if this L{X2GoSession} instance has an associated terminal session. + @return: returns C{True} if this L{X2GoSession} has a terminal session associated to itself @rtype: C{bool} @@ -1093,6 +1123,7 @@ class X2GoSession(object): which by itself calls the L{X2GoClient.HOOK_check_host_dialog()} method. Make sure you override any of these to enable user interaction on X2Go server validity checks. + @return: returns C{True} if an X2Go server host is valid for authentication @rtype: C{bool} @@ -1109,6 +1140,7 @@ class X2GoSession(object): """\ Check if a session is configured to use an intermediate SSH proxy server. + @return: returns C{True} if the session is configured to use an SSH proxy, C{False} otherwise. @rtype: C{bool} @@ -1121,6 +1153,7 @@ class X2GoSession(object): Check if a session is configured to re-use the X2Go session's password / key for proxy authentication, as well. + @return: returns C{True} if the session is configured to re-use session password / key for proxy authentication @rtype: C{bool} @@ -1133,6 +1166,7 @@ class X2GoSession(object): Check if a session's SSH proxy (if used) is configured adequately to be able to auto-connect to the SSH proxy server (e.g. by public key authentication). + @return: returns C{True} if the session's SSH proxy can auto-connect, C{False} otherwise, C{None} if no SSH proxy is used for this session, C{None} is returned. @rtype: C{bool} @@ -1162,6 +1196,7 @@ class X2GoSession(object): Check if a session is configured adequately to be able to auto-connect to the X2Go server (e.g. public key authentication). + @return: returns C{True} if the session can auto-connect, C{False} otherwise, C{None} if no control session has been set up yet. @rtype: C{bool} @@ -1196,6 +1231,8 @@ class X2GoSession(object): """\ Automatically connect this session. + @param redirect_to_client: Pass this request through to the L{X2GoClient} instance, if given (Default value = True) + @type redirect_to_client: C{True} @return: Return success (or failure) of connecting this sessions @rtype: C{bool} @@ -1219,46 +1256,44 @@ class X2GoSession(object): the C{X2GoControlSession*.connect()} method. @param username: the username for the X2Go server that is going to be - connected to (as a last minute way of changing the session username) + connected to (as a last minute way of changing the session username) (Default value = None) @type username: C{str} @param password: the user's password for the X2Go server that is going to be - connected to + connected to (Default value = None) @type password: C{str} @param passphrase: a passphrase to use for unlocking a private key in case the password is already needed for two-factor - authentication + authentication (Default value = None) @type passphrase: C{str} @param add_to_known_hosts: non-paramiko option, if C{True} paramiko.AutoAddPolicy() is used as missing-host-key-policy. If set to C{False} paramiko.RejectPolicy() - is used + is used (Default value = None) @type add_to_known_hosts: C{bool} @param force_password_auth: disable SSH pub/priv key authentication mechanisms - completely + completely (Default value = None) @type force_password_auth: C{bool} @param look_for_keys: set to C{True} to enable searching for discoverable - private key files in C{~/.ssh/} + private key files in C{~/.ssh/} (Default value = None) @type look_for_keys: C{bool} @param allow_agent: set to C{True} to enable connecting to a local SSH agent - for acquiring authentication information + for acquiring authentication information (Default value = None) @type allow_agent: C{bool} - @param use_sshproxy: use an SSH proxy host for connecting the target X2Go server + @param use_sshproxy: use an SSH proxy host for connecting the target X2Go server (Default value = None) @type use_sshproxy: C{bool} - @param sshproxy_reuse_authinfo: for proxy authentication re-use the X2Go session's password / key file + @param sshproxy_reuse_authinfo: for proxy authentication re-use the X2Go session's password / key file (Default value = None) @type sshproxy_reuse_authinfo: C{bool} - @param sshproxy_user: username for authentication against the SSH proxy host + @param sshproxy_user: username for authentication against the SSH proxy host (Default value = None) @type sshproxy_user: C{str} - @param sshproxy_password: password for authentication against the SSH proxy host + @param sshproxy_password: password for authentication against the SSH proxy host (Default value = None) @type sshproxy_password: C{str} @param sshproxy_passphrase: a passphrase to use for unlocking a private key needed for the SSH proxy host in case the sshproxy_password is already needed for - two-factor authentication + two-factor authentication (Default value = None) @type sshproxy_passphrase: C{str} - @param sshproxy_force_password_auth: enforce password authentication even is a key(file) is present + @param sshproxy_force_password_auth: enforce password authentication even is a key(file) is present (Default value = None) @type sshproxy_force_password_auth: C{bool} - @return: returns C{True} is the connection to the X2Go server has been successful - @rtype C{bool} - + @rtype: C{bool} @raise X2GoSessionException: on control session exceptions @raise X2GoRemoteHomeException: if the remote home directory does not exist @raise Exception: any other exception during connecting is passed through @@ -1366,6 +1401,7 @@ class X2GoSession(object): """\ Disconnect this L{X2GoSession} instance. + @return: returns C{True} if the disconnect operation has been successful @rtype: C{bool} @@ -1391,6 +1427,7 @@ class X2GoSession(object): """\ Query the X2Go server for a list of supported features. + """ self.server_features = self.control_session.query_server_features() self._SUPPORTED_TELEKINESIS = SUPPORTED_TELEKINESIS and self.has_server_feature('X2GO_TELEKINESIS') @@ -1400,6 +1437,7 @@ class X2GoSession(object): """\ Return a list of X2Go server-sides features (supported functionalities). + @return: a C{list} of X2Go feature names @rtype: C{list} @@ -1413,7 +1451,6 @@ class X2GoSession(object): @param feature: an X2Go server feature as found in C{$SHAREDIR/x2go/feature.d/*} @type feature: C{str} - @return: returns C{True} if the feature is present @rtype: C{bool} @@ -1427,7 +1464,7 @@ class X2GoSession(object): given title, it will be prepended, so that every X2Go session window always contains the X2Go session ID of that window. - @param title: new title for session window + @param title: new title for session window (Default value = '') @type title: C{str} """ @@ -1440,6 +1477,7 @@ class X2GoSession(object): Try to lift the session window above all other windows and bring it to focus. + """ if self.terminal_session is not None: self.terminal_session.raise_session_window() @@ -1470,6 +1508,7 @@ class X2GoSession(object): """\ Find out if this X2Go session is still alive (that is: connected to the server). + @return: returns C{True} if the server connection is still alive @rtype: C{bool} @@ -1486,9 +1525,9 @@ class X2GoSession(object): """\ Clean all running sessions for the authenticated user on the remote X2Go server. - @param destroy_terminals: destroy associated terminal sessions + @param destroy_terminals: destroy associated terminal sessions (Default value = True) @type destroy_terminals: C{bool} - @param published_applications: clean sessions that are published applications providers, too + @param published_applications: clean sessions that are published applications providers, too (Default value = False) @type published_applications: C{bool} """ @@ -1508,9 +1547,8 @@ class X2GoSession(object): List all sessions on the remote X2Go server that are owned by the authenticated user @param raw: if C{True} the output of this method equals - the output of the server-side C{x2golistsessions} command + the output of the server-side C{x2golistsessions} command (Default value = False) @type raw: C{bool} - @return: a session list (as data object or list of strings when called with C{raw=True} option) @rtype: C{X2GoServerSessionList*} instance or C{list} @@ -1528,9 +1566,8 @@ class X2GoSession(object): List X2Go desktops sessions available for desktop sharing on the remote X2Go server. @param raw: if C{True} the output of this method equals - the output of the server-side C{x2golistdesktops} command + the output of the server-side C{x2golistdesktops} command (Default value = False) @type raw: C{bool} - @return: a list of strings representing available desktop sessions @rtype: C{list} @@ -1552,9 +1589,8 @@ class X2GoSession(object): retrieve its list of mounted client shares for that session. @param raw: output the list of mounted client shares in X2Go's - raw C{x2golistmounts} format + raw C{x2golistmounts} format (Default value = False) @type raw: C{bool} - @return: a list of strings representing mounted client shares for this session @rtype: C{list} @@ -1582,11 +1618,10 @@ class X2GoSession(object): is always up-to-date. @param session_list: provide an C{X2GoServerSessionList*} that refers to X2Go sessions we want to update. - This option is mainly for reducing server/client traffic. + This option is mainly for reducing server/client traffic. (Default value = None) @type session_list: C{X2GoServerSessionList*} instance - @param force_update: force a session status update, if if the last update is less then 1 second ago + @param force_update: force a session status update, if if the last update is less then 1 second ago (Default value = False) @type force_update: C{bool} - @raise Exception: any exception is passed through in case the session disconnected surprisingly or has been marked as faulty @@ -1652,6 +1687,7 @@ class X2GoSession(object): """\ Returns true if this session runs in published applications mode. + @return: returns C{True} if this session is a provider session for published applications. @rtype: C{bool} @@ -1666,15 +1702,17 @@ class X2GoSession(object): Return a list of published menu items from the X2Go server for session type published applications. - @param lang: locale/language identifier + @param lang: locale/language identifier (Default value = None) @type lang: C{str} - @param refresh: force reload of the menu tree from X2Go server + @param refresh: force reload of the menu tree from X2Go server (Default value = False) @type refresh: C{bool} - @param raw: retrieve a raw output of the server list of published applications + @param raw: retrieve a raw output of the server list of published applications (Default value = False) @type raw: C{bool} - @param very_raw: retrieve a very raw output of the server list of published applications (as-is output of x2gogetapps script) + @param very_raw: retrieve a very raw output of the server list of published applications (as-is output of x2gogetapps script) (Default value = False) @type very_raw: C{bool} - + @param max_no_submenus: Number of applications before applications are put into XDG category submenus + (Default value = defaults.PUBAPP_MAX_NO_SUBMENUS) + @type max_no_submenus: C{int} @return: A C{list} of C{dict} elements. Each C{dict} elements has a C{desktop} key containing the text output of a .desktop file and an C{icon} key which contains the desktop icon data base64 encoded @@ -1692,6 +1730,8 @@ class X2GoSession(object): @param exec_name: command to execute on server @type exec_name: C{str} + @param timeout: time in secs to wait for server query to reply (Default value = 20) + @type timeout: C{int} """ if self.terminal_session is not None: @@ -1707,17 +1747,16 @@ class X2GoSession(object): Sessions in published applications mode are not resumed/started by this method. - @param newest: if resuming, only resume newest/youngest session + @param newest: if resuming, only resume newest/youngest session (Default value = True) @type newest: C{bool} - @param oldest: if resuming, only resume oldest session + @param oldest: if resuming, only resume oldest session (Default value = False) @type oldest: C{bool} - @param all_suspended: if resuming, resume all suspended sessions + @param all_suspended: if resuming, resume all suspended sessions (Default value = False) @type all_suspended: C{bool} - @param start: is no session is to be resumed, start a new session + @param start: is no session is to be resumed, start a new session (Default value = True) @type start: C{bool} - @param redirect_to_client: redirect this call to the L{X2GoClient} instance (if available) to allow frontend interaction + @param redirect_to_client: redirect this call to the L{X2GoClient} instance (if available) to allow frontend interaction (Default value = True) @type redirect_to_client: C{bool} - @return: returns success (or failure) of starting/resuming this sessions @rtype: C{bool} @@ -1755,6 +1794,7 @@ class X2GoSession(object): """\ Reset session startup/resumption progress status. + """ self._progress_status = 0 @@ -1762,6 +1802,7 @@ class X2GoSession(object): """\ Retrieve session startup/resumption progress status. + @return: returns an C{int} value between 0 and 100 reflecting the session startup/resumption status @rtype: C{int} @@ -1773,20 +1814,18 @@ class X2GoSession(object): Resume or continue a suspended / running X2Go session on the remote X2Go server. - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @param session_list: a session list to avoid a server-side session list query + @param session_list: a session list to avoid a server-side session list query (Default value = None) @type session_list: C{dict} @param cmd: if starting a new session, manually hand over the command to be launched in - the new session + the new session (Default value = None) @type cmd: C{str} @param progress_event: a C{thread.Event} object that notifies a status object like the one in - L{utils.ProgressStatus}. + L{utils.ProgressStatus}. (Default value = None) @type progress_event: C{obj} - @return: returns C{True} if resuming the session has been successful, C{False} otherwise @rtype: C{bool} - @raise Exception: any exception that occurs during published application menu retrieval is passed through """ @@ -1807,20 +1846,18 @@ class X2GoSession(object): Resume or continue a suspended / running X2Go session on the remote X2Go server. - @param session_name: the server-side name of an X2Go session + @param session_name: the server-side name of an X2Go session (Default value = None) @type session_name: C{str} - @param session_list: a session list to avoid a server-side session list query + @param session_list: a session list to avoid a server-side session list query (Default value = None) @type session_list: C{dict} @param cmd: if starting a new session, manually hand over the command to be launched in - the new session + the new session (Default value = None) @type cmd: C{str} @param progress_event: a C{thread.Event} object that notifies a status object like the one in - L{utils.ProgressStatus}. + L{utils.ProgressStatus}. (Default value = None) @type progress_event: C{obj} - @return: returns C{True} if resuming the session has been successful, C{False} otherwise @rtype: C{bool} - @raise Exception: any exception that occurs during published application menu retrieval is passed through """ @@ -2058,12 +2095,11 @@ class X2GoSession(object): """\ Start a new X2Go session on the remote X2Go server. - @param cmd: manually hand over the command that is to be launched in the new session + @param cmd: manually hand over the command that is to be launched in the new session (Default value = None) @type cmd: C{str} @param progress_event: a C{thread.Event} object that notifies a status object like the one in - L{utils.ProgressStatus}. + L{utils.ProgressStatus}. (Default value = None) @type progress_event: C{obj} - @return: returns C{True} if starting the session has been successful, C{False} otherwise @rtype: C{bool} @@ -2077,26 +2113,24 @@ class X2GoSession(object): Share an already running X2Go session on the remote X2Go server locally. The shared session may be either owned by the same user or by a user that grants access to his/her desktop session by the local user. - @param desktop: desktop ID of a sharable desktop in format <user>@<display> + @param desktop: desktop ID of a sharable desktop in format <user>@<display> (Default value = None) @type desktop: C{str} @param user: user name and display number can be given separately, here give the - name of the user who wants to share a session with you. + name of the user who wants to share a session with you. (Default value = None) @type user: C{str} @param display: user name and display number can be given separately, here give the - number of the display that a user allows you to be shared with. + number of the display that a user allows you to be shared with. (Default value = None) @type display: C{str} - @param share_mode: desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. + @param share_mode: desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. (Default value = 0) @type share_mode: C{int} @param check_desktop_list: check if the given desktop is available on the X2Go server; handle with care as - the server-side C{x2golistdesktops} command might block client I/O. + the server-side C{x2golistdesktops} command might block client I/O. (Default value = True) @type check_desktop_list: C{bool} @param progress_event: a C{thread.Event} object that notifies a status object like the one in - L{utils.ProgressStatus}. + L{utils.ProgressStatus}. (Default value = None) @type progress_event: C{obj} - @return: returns C{True} if starting the session has been successful, C{False} otherwise @rtype: C{bool} - @raise X2GoDesktopSharingException: if a given desktop ID does not specify an available desktop session @raise X2GoSessionException: if the available desktop session appears to be dead, in fact @@ -2118,26 +2152,24 @@ class X2GoSession(object): Share an already running X2Go session on the remote X2Go server locally. The shared session may be either owned by the same user or by a user that grants access to his/her desktop session by the local user. - @param desktop: desktop ID of a sharable desktop in format <user>@<display> + @param desktop: desktop ID of a sharable desktop in format <user>@<display> (Default value = None) @type desktop: C{str} @param user: user name and display number can be given separately, here give the - name of the user who wants to share a session with you. + name of the user who wants to share a session with you. (Default value = None) @type user: C{str} @param display: user name and display number can be given separately, here give the - number of the display that a user allows you to be shared with. + number of the display that a user allows you to be shared with. (Default value = None) @type display: C{str} - @param share_mode: desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. + @param share_mode: desktop sharing mode, 0 is VIEW-ONLY, 1 is FULL-ACCESS. (Default value = 0) @type share_mode: C{int} @param check_desktop_list: check if the given desktop is available on the X2Go server; handle with care as - the server-side C{x2golistdesktops} command might block client I/O. + the server-side C{x2golistdesktops} command might block client I/O. (Default value = True) @type check_desktop_list: C{bool} @param progress_event: a C{thread.Event} object that notifies a status object like the one in - L{utils.ProgressStatus}. + L{utils.ProgressStatus}. (Default value = None) @type progress_event: C{obj} - @return: returns C{True} if starting the session has been successful, C{False} otherwise @rtype: C{bool} - @raise X2GoDesktopSharingException: if a given desktop ID does not specify an available desktop session @raise X2GoSessionException: if the available desktop session appears to be dead, in fact @@ -2249,6 +2281,7 @@ class X2GoSession(object): """\ Test if this X2Go session is a desktop session. + @return: C{True} if this session is of session type desktop ('D'). @rtype: C{bool} @@ -2261,6 +2294,7 @@ class X2GoSession(object): """\ Test if this X2Go session is a rootless session. + @return: C{True} if this session is of session type rootless ('R'). @rtype: C{bool} @@ -2273,6 +2307,7 @@ class X2GoSession(object): """\ Test if this X2Go session is a desktop sharing (aka shadow) session. + @return: C{True} if this session is of session type shadow ('S'). @rtype: C{bool} @@ -2285,6 +2320,7 @@ class X2GoSession(object): """\ Test if this X2Go session is a published applications session. + @return: C{True} if this session is of session type published applications ('P'). @rtype: C{bool} @@ -2297,9 +2333,9 @@ class X2GoSession(object): """\ Suspend this X2Go session. + @return: returns C{True} if suspending the session has been successful, C{False} otherwise @rtype: C{bool} - @raise X2GoSessionException: if the session could not be suspended """ @@ -2319,9 +2355,9 @@ class X2GoSession(object): """\ Suspend this X2Go session. + @return: returns C{True} if suspending the session has been successful, C{False} otherwise @rtype: C{bool} - @raise X2GoSessionException: if the session could not be suspended """ @@ -2370,9 +2406,9 @@ class X2GoSession(object): """\ Terminate this X2Go session. + @return: returns C{True} if terminating the session has been successful, C{False} otherwise @rtype: C{bool} - @raise X2GoSessionException: if the session could not be terminated """ @@ -2392,9 +2428,9 @@ class X2GoSession(object): """\ Terminate this X2Go session. + @return: returns C{True} if terminating the session has been successful, C{False} otherwise @rtype: C{bool} - @raise X2GoSessionException: if the session could not be terminated """ @@ -2442,6 +2478,7 @@ class X2GoSession(object): """\ Retrieve the profile name of this L{X2GoSession} instance. + @return: X2Go client profile name of the session @rtype: C{str} @@ -2453,6 +2490,7 @@ class X2GoSession(object): """\ Retrieve the profile ID of this L{X2GoSession} instance. + @return: the session profile's id @rtype: C{str} @@ -2469,6 +2507,7 @@ class X2GoSession(object): Test if this C{X2GoSession} is in a healthy state. + @return: C{True} if session is ok, C{False} otherwise @rtype: C{bool} @@ -2482,6 +2521,7 @@ class X2GoSession(object): """\ Extract color depth from session name. + @return: the session's color depth (as found in the session name) @rtype: C{str} @@ -2496,6 +2536,7 @@ class X2GoSession(object): """\ Check if this session will display properly with the local screen's color depth. + @return: C{True} if the session will display on this client screen, C{False} otherwise. If no terminal session is yet registered with this session, C{None} is returned. @rtype: C{bool} @@ -2516,6 +2557,7 @@ class X2GoSession(object): Test if the L{X2GoSession}'s control session is connected to the remote X2Go server. + @return: C{True} if session is connected, C{False} otherwise @rtype: C{bool} @@ -2533,6 +2575,8 @@ class X2GoSession(object): """\ Test if the L{X2GoSession}'s terminal session is up and running. + @param update_status: if C{True}, the status is updated by a server call (Default value = False) + @type update_status: C{bool} @return: C{True} if session is running, C{False} otherwise @rtype: C{bool} @@ -2555,6 +2599,8 @@ class X2GoSession(object): """\ Test if the L{X2GoSession}'s terminal session is in suspended state. + @param update_status: if C{True}, the status is updated by a server call (Default value = False) + @type update_status: C{bool} @return: C{True} if session is suspended, C{False} otherwise @rtype: C{bool} @@ -2577,6 +2623,8 @@ class X2GoSession(object): """\ Test if the L{X2GoSession}'s terminal session has terminated. + @param update_status: if C{True}, the status is updated by a server call (Default value = False) + @type update_status: C{bool} @return: C{True} if session has terminated, C{False} otherwise @rtype: C{bool} @@ -2630,17 +2678,15 @@ class X2GoSession(object): Share a local folder with this registered X2Go session. @param local_path: the full path to an existing folder on the local - file system + file system (Default value = None) @type local_path: C{str} - @param folder_name: synonymous to C{local_path} + @param folder_name: synonymous to C{local_path} (Default value = None) @type folder_name: C{str} - @param update_exported_folders: do an update of the session profile option ,,export'' after the operation + @param update_exported_folders: do an update of the session profile option ,,export'' after the operation (Default value = True) @type update_exported_folders: C{bool} - @return: returns C{True} if the local folder has been successfully mounted within this X2Go session @rtype: C{bool} - @raise X2GoSessionException: if this L{X2GoSession} does not have an associated terminal session """ @@ -2695,9 +2741,8 @@ class X2GoSession(object): """\ Share all local folders configured to be mounted within this X2Go session. - @param update_exported_folders: do an update of the session profile option ,,export'' after the operation + @param update_exported_folders: do an update of the session profile option ,,export'' after the operation (Default value = True) @type update_exported_folders: C{bool} - @return: returns C{True} if all local folders could be successfully mounted inside this X2Go session @rtype: C{bool} @@ -2735,15 +2780,13 @@ class X2GoSession(object): @param local_path: the full path to an existing folder on the local file system that is mounted in this X2Go session and shall be - unmounted + unmounted (Default value = None) @type local_path: C{str} - @param update_exported_folders: do an update of the session profile option ,,export'' after the operation + @param update_exported_folders: do an update of the session profile option ,,export'' after the operation (Default value = True) @type update_exported_folders: C{bool} - @return: returns C{True} if all local folders could be successfully unmounted inside this X2Go session @rtype: C{bool} - @raise X2GoSessionException: if this L{X2GoSession} does not have an associated terminal session """ @@ -2778,15 +2821,13 @@ class X2GoSession(object): Unshare all local folders mounted within this X2Go session. @param force_all: Really unmount _all_ shared folders, including the print spool folder and - the MIME box spool dir (not recommended). + the MIME box spool dir (not recommended). (Default value = False) @type force_all: C{bool} - @param update_exported_folders: do an update of the session profile option ,,export'' after the operation + @param update_exported_folders: do an update of the session profile option ,,export'' after the operation (Default value = True) @type update_exported_folders: C{bool} - @return: returns C{True} if all local folders could be successfully unmounted inside this X2Go session @rtype: C{bool} - @raise X2GoSessionException: if this L{X2GoSession} does not have an associated terminal session """ @@ -2817,11 +2858,10 @@ class X2GoSession(object): Get a list of local folders mounted within this X2Go session from this client. @param check_list_mounts: if set to C{True} the list of shared folders is referenced against - the latest status of the server-side mount list. + the latest status of the server-side mount list. (Default value = False) @type check_list_mounts: C{bool} - @param mounts: a server-side dictionary of session name keys and lists of mounted shares (server-side mount points) + @param mounts: a server-side dictionary of session name keys and lists of mounted shares (server-side mount points) (Default value = None) @type mounts: C{dict} - @return: returns a C{list} of those local folder names that are mounted with this X2Go session. @rtype: C{list} @@ -2876,6 +2916,7 @@ class X2GoSession(object): """\ Clean up X2Go session. + """ # release terminal session's proxy if self.has_terminal_session(): @@ -2898,6 +2939,7 @@ class X2GoSession(object): if there is some action running that will result in a session status change. + @return: returns C{True} if the session is locked @rtype: C{bool} diff --git a/x2go/sftpserver.py b/x2go/sftpserver.py index 98784ff..4ec4488 100644 --- a/x2go/sftpserver.py +++ b/x2go/sftpserver.py @@ -52,6 +52,7 @@ class _SSHServer(paramiko.ServerInterface): Implementation of a basic SSH server that is supposed to run with its sFTP server implementation. + """ def __init__(self, auth_key=None, session_instance=None, logger=None, loglevel=log.loglevel_DEFAULT, *args, **kwargs): """\ @@ -88,7 +89,6 @@ class _SSHServer(paramiko.ServerInterface): @type kind: C{str} @param chanid: channel id (unused) @type chanid: C{any} - @return: returns a Paramiko/SSH return code @rtype: C{int} @@ -106,7 +106,6 @@ class _SSHServer(paramiko.ServerInterface): @type username: C{str} @param key: incoming SSH key to be used for authentication @type key: C{paramiko.RSAKey} instance - @return: returns a Paramiko/SSH return code @rtype: C{int} @@ -125,7 +124,6 @@ class _SSHServer(paramiko.ServerInterface): @param username: username of incoming authentication request @type username: C{str} - @return: statically returns C{publickey} as auth mechanism @rtype: C{str} @@ -138,13 +136,14 @@ class _SFTPHandle(paramiko.SFTPHandle): """\ Represents a handle to an open file. + """ def stat(self): """\ Create an SFTPAttributes object from an existing stat object (an object returned by os.stat). - return: new C{SFTPAttributes} object with the same attribute fields. - rtype: C{obj} + @return: new C{SFTPAttributes} object with the same attribute fields. + @rtype: C{obj} """ try: @@ -157,6 +156,7 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): """\ sFTP server implementation. + """ def __init__(self, server, chroot=None, logger=None, loglevel=log.loglevel_DEFAULT, server_event=None, *args, **kwargs): """\ @@ -192,7 +192,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: path name within chroot @type path: C{str} - @return: real path name (including drive letter on Windows systems) @rtype: C{str} @@ -214,7 +213,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: path to folder @type path: C{str} - @return: returns the folder contents, on failure returns a Paramiko/SSH return code @rtype: C{dict} or C{int} @@ -247,7 +245,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: path to file/folder @type path: C{str} - @return: returns the file's stat output, on failure: returns a Paramiko/SSH return code @rtype: C{class} or C{int} @@ -266,7 +263,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: path to folder @type path: C{str} - @return: returns the file's lstat output, on failure: returns a Paramiko/SSH return code @rtype: C{class} or C{int} @@ -289,7 +285,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @type flags: C{str} @param attr: file attributes @type attr: C{class} - @return: file handle/object for remote file, on failure: returns a Paramiko/SSH return code @rtype: L{_SFTPHandle} instance or C{int} @@ -342,7 +337,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: path to file @type path: C{str} - @return: returns Paramiko/SSH return code @rtype: C{int} @@ -360,7 +354,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @type oldpath: C{str} @param newpath: new path/location/file name @type newpath: C{str} - @return: returns Paramiko/SSH return code @rtype: C{int} @@ -383,7 +376,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @type path: C{str} @param attr: file attributes @type attr: C{class} - @return: returns Paramiko/SSH return code @rtype: C{int} @@ -403,7 +395,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: folder to be removed @type path: C{str} - @return: returns Paramiko/SSH return code @rtype: C{int} @@ -425,7 +416,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @type path: C{str} @param attr: new file attributes @type attr: C{class} - @return: returns Paramiko/SSH return code @rtype: C{int} @@ -450,7 +440,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @type target_path: C{str} @param path: link location @type path: C{str} - @return: returns Paramiko/SSH return code @rtype: C{int} @@ -472,7 +461,6 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): @param path: path of symbolic link @type path: C{str} - @return: target location of the symbolic link, on failure: returns a Paramiko/SSH return code @rtype: C{str} or C{int} @@ -488,6 +476,7 @@ class _SFTPServerInterface(paramiko.SFTPServerInterface): """\ Tidy up when the sFTP session has ended. + """ if self.server_event is not None: self.logger('sFTP server %s: session has ended' % self, loglevel=log.loglevel_DEBUG_SFTPXFER) @@ -500,6 +489,7 @@ class X2GoRevFwTunnelToSFTP(rforward.X2GoRevFwTunnel): reverse forwarding tunnel is used to provide access to local X2Go client folders from within the the remote X2Go server session. + """ def __init__(self, server_port, ssh_transport, auth_key=None, session_instance=None, logger=None, loglevel=log.loglevel_DEFAULT): """\ @@ -562,6 +552,7 @@ class X2GoRevFwTunnelToSFTP(rforward.X2GoRevFwTunnel): until the tunnel gets paused by an L{X2GoRevFwTunnelToSFTP.pause()} call or stopped via the C{X2GoRevFwTunnelToSFTP.stop_thread()} method. + """ self._request_port_forwarding() self._keepalive = True @@ -607,12 +598,12 @@ def x2go_rev_forward_sftpchannel_handler(chan=None, auth_key=None, logger=None): tunneled SSH connections associated to this L{X2GoRevFwTunnelToSFTP} instance from within a Python X2Go application. - @param chan: an incoming sFTP channel + @param chan: an incoming sFTP channel (Default value = None) @type chan: paramiko.Channel instance @param auth_key: Paramiko/SSH RSAkey object that has to be authenticated against by - the remote sFTP client + the remote sFTP client (Default value = None) @type auth_key: C{paramiko.RSAKey} instance - @param logger: you must pass an L{X2GoLogger} object to this handler method + @param logger: you must pass an L{X2GoLogger} object to this handler method (Default value = None) @type logger: C{X2GoLogger} instance """ diff --git a/x2go/sshproxy.py b/x2go/sshproxy.py index e775de1..421e0f3 100644 --- a/x2go/sshproxy.py +++ b/x2go/sshproxy.py @@ -58,6 +58,7 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ X2GoSSHProxy can be used to proxy X2Go connections through a firewall via SSH. + """ fw_tunnel = None @@ -392,6 +393,7 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Wraps around a Paramiko/SSH host key check. + """ _hostname = self.hostname @@ -409,6 +411,7 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Start the SSH proxying tunnel... + @raise X2GoSSHProxyException: if the SSH proxy could not retrieve an SSH transport for proxying a X2Go server-client connection """ @@ -433,7 +436,9 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Retrieve the local IP socket address this SSH proxying tunnel is (about to) bind/bound to. + @return: local IP socket address + @rtype: C{str} """ @@ -443,7 +448,9 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Retrieve the local IP socket port this SSH proxying tunnel is (about to) bind/bound to. + @return: local IP socket port + @rtype: C{int} """ @@ -453,7 +460,9 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Retrieve the remote IP socket address at the remote end of the SSH proxying tunnel. + @return: remote IP socket address + @rtype: C{str} """ @@ -463,7 +472,9 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Retrieve the remote IP socket port of the target system's SSH daemon. + @return: remote SSH port + @rtype: C{int} """ @@ -473,6 +484,7 @@ class X2GoSSHProxy(paramiko.SSHClient, threading.Thread): """\ Tear down the SSH proxying tunnel. + """ if self.fw_tunnel is not None and self.fw_tunnel.is_active: self.logger('taking down SSH proxy tunnel via [%s]:%s' % (self.hostname, self.port), loglevel=log.loglevel_NOTICE) diff --git a/x2go/telekinesis.py b/x2go/telekinesis.py index 37d85a7..cc0c326 100644 --- a/x2go/telekinesis.py +++ b/x2go/telekinesis.py @@ -58,6 +58,7 @@ class X2GoTelekinesisClient(threading.Thread): This class implements the startup of the telekinesis client used by Python X2Go. + """ TEKICLIENT_CMD = 'telekinesis-client' """Telekinesis client command. Might be OS specific.""" @@ -141,7 +142,9 @@ class X2GoTelekinesisClient(threading.Thread): """\ Test if the Telekinesis client command is installed on this machine. + @return: C{True} if the Telekinesis client command is available + @rtype: C{bool} """ @@ -158,6 +161,7 @@ class X2GoTelekinesisClient(threading.Thread): Close any left open port forwarding tunnel, also close Telekinesis client's log file, if left open. + """ if self.tekiclient: self.logger('Shutting down Telekinesis client subprocess', loglevel=log.loglevel_DEBUG) @@ -200,6 +204,7 @@ class X2GoTelekinesisClient(threading.Thread): """\ End the thread runner and tidy up. + """ self._keepalive = False # wait for thread loop to finish... @@ -216,6 +221,7 @@ class X2GoTelekinesisClient(threading.Thread): Paramiko/SSH based forwarding tunnel (openssh -L option). This tunnel gets started here and is forked into background (Greenlet/gevent). + """ self._keepalive = True self.tekiclient = None @@ -283,6 +289,7 @@ class X2GoTelekinesisClient(threading.Thread): """\ Generate the NX proxy command line for execution. + """ cmd_line = [ self.TEKICLIENT_CMD, ] _tekiclient_args = " ".join(self.TEKICLIENT_ARGS).format(sid=self.session_name).split(' ') @@ -293,7 +300,9 @@ class X2GoTelekinesisClient(threading.Thread): """\ Start the thread runner and wait for the Telekinesis client to come up. + @return: a subprocess instance that knows about the externally started Telekinesis client command. + @rtype: C{obj} """ @@ -404,8 +413,10 @@ class X2GoTelekinesisClient(threading.Thread): """\ Check if a proxy instance is up and running. + @return: Proxy state, C{True} for proxy being up-and-running, C{False} otherwise - @rtype C{bool} + + @rtype: C{bool} """ return bool(self.tekiclient and self.tekiclient.poll() is None) and self.fw_ctrl_tunnel.is_active and self.fw_data_tunnel.is_active diff --git a/x2go/tests/test_printing.py b/x2go/tests/test_printing.py index 9b0b124..a46646d 100644 --- a/x2go/tests/test_printing.py +++ b/x2go/tests/test_printing.py @@ -29,19 +29,18 @@ import x2go class TestX2GoClientPrinting(unittest.TestCase): def test_client_printing_dialog(self): - _printing = """\ -[General] -pdfview=true -showdialog=true -[print] -startcmd=false -command=lpr -[view] -open=true -command=xpdf -[CUPS] -defaultprinter=PDF -""" + """_printing = """\ + [General] + pdfview=true + showdialog=true + [print] + startcmd=false + command=lpr + [view] + open=true + command=xpdf + [CUPS] + defaultprinter=PDF tf = tempfile.NamedTemporaryFile() print(_printing, file=tf) tf.seek(0) @@ -50,18 +49,17 @@ defaultprinter=PDF tf.close() def test_client_printing_pdfview(self): - _printing = """\ -[General] -pdfview=true -[print] -startcmd=false -command=lpr -[view] -open=true -command=xpdf -[CUPS] -defaultprinter=PDF -""" + """_printing = """\ + [General] + pdfview=true + [print] + startcmd=false + command=lpr + [view] + open=true + command=xpdf + [CUPS] + defaultprinter=PDF tf = tempfile.NamedTemporaryFile() print(_printing, file=tf) tf.seek(0) @@ -70,18 +68,17 @@ defaultprinter=PDF tf.close() def test_client_printing_pdfsave(self): - _printing = """\ -[General] -pdfview=true -[print] -startcmd=false -command=lpr -[view] -open=false -command=xpdf -[CUPS] -defaultprinter=PDF -""" + """_printing = """\ + [General] + pdfview=true + [print] + startcmd=false + command=lpr + [view] + open=false + command=xpdf + [CUPS] + defaultprinter=PDF tf = tempfile.NamedTemporaryFile() print(_printing, file=tf) tf.seek(0) @@ -90,18 +87,17 @@ defaultprinter=PDF tf.close() def test_client_printing_print(self): - _printing = """\ -[General] -pdfview=false -[print] -startcmd=false -command=lpr -[view] -open=false -command=xpdf -[CUPS] -defaultprinter=PDF -""" + """_printing = """\ + [General] + pdfview=false + [print] + startcmd=false + command=lpr + [view] + open=false + command=xpdf + [CUPS] + defaultprinter=PDF tf = tempfile.NamedTemporaryFile() print(_printing, file=tf) tf.seek(0) @@ -110,18 +106,17 @@ defaultprinter=PDF tf.close() def test_client_printing_printcmd(self): - _printing = """\ -[General] -pdfview=false -[print] -startcmd=true -command=lpr -[view] -open=false -command=xpdf -[CUPS] -defaultprinter=PDF -""" + """_printing = """\ + [General] + pdfview=false + [print] + startcmd=true + command=lpr + [view] + open=false + command=xpdf + [CUPS] + defaultprinter=PDF tf = tempfile.NamedTemporaryFile() print(_printing, file=tf) tf.seek(0) diff --git a/x2go/utils.py b/x2go/utils.py index ef58355..79005bb 100644 --- a/x2go/utils.py +++ b/x2go/utils.py @@ -66,6 +66,8 @@ def is_in_nx3packmethods(method): """\ Test if a given compression method is valid for NX3 Proxy. + @param method: name of an NXv3 pack method + @type method: C{str} @return: C{True} if C{method} is in the hard-coded list of NX3 compression methods. @rtype: C{bool} @@ -82,7 +84,6 @@ def find_session_line_in_x2golistsessions(session_name, stdout): @type session_name: C{str} @param stdout: raw output from the ,,x2golistsessions'' command, as list of strings @type stdout: C{list} - @return: the output line that contains C{<session_name>} @rtype: C{str} or C{None} @@ -104,7 +105,6 @@ def slugify(value): @param value: a string that shall be sluggified @type value: C{str} - @return: the sluggified string @rtype: C{str} @@ -120,7 +120,9 @@ def _genSessionProfileId(): """\ Generate a session profile ID as used in x2goclient's sessions config file. + @return: profile ID + @rtype: C{str} """ @@ -134,7 +136,6 @@ def _checkIniFileDefaults(data_structure): @param data_structure: an ini file date structure @type data_structure: C{dict} of C{dict}s - @return: C{True} if C{data_structure} matches that of an ini file data structure @rtype: C{bool} @@ -155,7 +156,6 @@ def _checkSessionProfileDefaults(data_structure): @param data_structure: an ini file date structure @type data_structure: C{dict} of C{dict}s - @return: C{True} if C{data_structure} matches that of an ini file data structure @rtype: C{bool} @@ -174,7 +174,6 @@ def _convert_SessionProfileOptions_2_SessionParams(options): @param options: a dictionary of options, parameter names as in the X2Go ,,sessions'' file @type options: C{dict} - @return: session options as used in C{X2GoSession} instances @rtype: C{dict} @@ -388,7 +387,6 @@ def session_names_by_timestamp(session_infos): @param session_infos: a dictionary of session infos as reported by L{X2GoClient.list_sessions()} @type session_infos: C{dict} - @return: a timestamp-sorted list of session names found in C{session_infos} @rtype: C{list} @@ -405,7 +403,7 @@ def touch_file(filename, mode='a'): @param filename: name of the file to touch @type filename: C{str} - @param mode: the file mode (as used for Python file objects) + @param mode: the file mode (as used for Python file objects) (Default value = 'a') @type mode: C{str} """ @@ -421,7 +419,6 @@ def unique(seq): @param seq: a list/sequence containing consecutive duplicates. @type seq: C{list} - @return: list that has been clean up from the consecutive duplicates @rtype: C{list} @@ -437,6 +434,7 @@ def known_encodings(): Render a list of all-known-to-Python character encodings (including all known aliases) + """ from encodings.aliases import aliases _raw_encname_list = [] @@ -477,11 +475,10 @@ def detect_unused_port(bind_address='127.0.0.1', preferred_port=None): """\ Detect an unused IP socket. - @param bind_address: IP address to bind to + @param bind_address: IP address to bind to (Default value = '127.0.0.1') @type bind_address: C{str} - @param preferred_port: IP socket port that shall be tried first for availability + @param preferred_port: IP socket port that shall be tried first for availability (Default value = None) @type preferred_port: C{str} - @return: free local IP socket port that can be used for binding @rtype: C{str} @@ -503,7 +500,9 @@ def get_encoding(): """\ Detect systems default character encoding. + @return: The system's local character encoding. + @rtype: C{str} """ @@ -525,7 +524,6 @@ def is_abs_path(path): @param path: test this path for absolutism... @type path: C{str} - @return: Returns C{True} if path is an absolute path name @rtype: C{bool} @@ -537,7 +535,9 @@ def xkb_rules_names(): """\ Wrapper for: xprop -root _XKB_RULES_NAMES + @return: A Python dictionary that contains the current X11 keyboard rules. + @rtype: C{dict} """ @@ -556,7 +556,9 @@ def local_color_depth(): """\ Detect the current local screen's color depth. + @return: the local color depth in bits + @rtype: C{int} """ @@ -589,7 +591,6 @@ def is_color_depth_ok(depth_session, depth_local): @type depth_session: C{int} @param depth_local: color depth of local screen @type depth_local: C{int} - @return: Does the session color depth work with the local display? @rtype: C{bool} @@ -611,7 +612,6 @@ def find_session_window(session_name): @param session_name: session name/ID of an X2Go session window @type session_name: C{str} - @return: the window object (or ID) of the searched for session window @rtype: C{obj} on Unix, C{int} on Windows @@ -664,7 +664,9 @@ def get_desktop_geometry(): """\ Get the geometry of the current screen's desktop. + @return: a (<width>, <height>) tuple will be returned + @rtype: C{tuple} """ @@ -683,7 +685,9 @@ def get_workarea_geometry(): xprop -root '_NET_WORKAREA' + @return: a (<width>, <height>) tuple will be returned + @rtype: C{tuple} """ @@ -744,7 +748,6 @@ def merge_ordered_lists(l1, l2): @type l1: C{list} @param l2: second sorted list @type l2: C{list} - @return: the merge result of both sorted lists @rtype: C{list} @@ -798,6 +801,7 @@ class ProgressStatus(object): """\ A simple progress status iterator class. + """ def __init__(self, progress_event, progress_func=list(range(0, 100, 10))): """\ @@ -859,7 +863,7 @@ def genkeypair(local_username, client_address, key_type='RSA'): @type local_username: C{unicode} @param client_address: the key is only valid for this client @type client_address: C{unicode} - @param key_type: either of: RSA, DSA + @param key_type: either of: RSA, DSA (Default value = 'RSA') @type key_type: C{unicode} """ @@ -893,7 +897,6 @@ def which(basename): @param basename: the basename of an application to be search for in $PATH @type basename: C{str} - @return: full path to the application @rtype: C{str} diff --git a/x2go/xserver.py b/x2go/xserver.py index 7afcd24..1ecf022 100644 --- a/x2go/xserver.py +++ b/x2go/xserver.py @@ -53,6 +53,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): This class is needed for Windows systems and (maybe soon) for Unix desktops using Wayland. + """ def __init__(self, config_files=_X2GO_XCONFIG_CONFIGFILES, defaults=_X2GO_CLIENTXCONFIG_DEFAULTS, logger=None, loglevel=log.loglevel_DEFAULT): @@ -102,6 +103,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): For writing the first of the C{config_files} specified on instance construction that is writable will be used. + @return: C{True} if the user config file has been successfully written, C{False} otherwise. @rtype: C{bool} @@ -115,7 +117,6 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): @param xserver_name: name of the XServer application @type xserver_name: C{str} - @return: A Python dictionary containing the XServer's configuration settings @rtype: C{list} @@ -133,6 +134,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): """\ Renders a list of XServers that are known to Python X2Go. + """ return self.get_value('XServers', 'known_xservers') @@ -142,6 +144,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): Among the known XServers renders a list of XServers that are actually installed on the system. + """ _installed = [] for xserver_name in self.known_xservers: @@ -154,6 +157,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): """\ Tries to render a list of running XServer processes from the system's process list. + """ _running = [] _wmi = wmi.WMI() @@ -174,6 +178,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): Detect if there is an XServer (that is known to Python X2Go) installed on the system. Equals C{True} if we have found an installed XServer that we can launch. + """ return bool(self.installed_xservers) @@ -184,6 +189,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): Equals C{True} if we have to launch an XServer before we can start/resume X2Go sessions. + """ return not bool(self.running_xservers) @@ -192,8 +198,8 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): """\ Returns a tuple of (<xserver_name>, <xserver_config>). - return: (<xserver_name>, <xserver_config>) - rtype: C{tuple} + @return: (<xserver_name>, <xserver_config>) + @rtype: C{tuple} """ if self.xserver_launch_possible: @@ -206,6 +212,7 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): """\ Returns the list of preferred XServer names (most preferred first). + """ return self.installed_xservers @@ -262,12 +269,13 @@ class X2GoClientXConfig(inifiles.X2GoIniFile): class X2GoXServer(threading.Thread): - """ + """\ This class is responsible for starting/stopping an external XServer application. X2Go applications require a running XServer on the client system. This class will manage/handle the XServer while your X2Go application is running. + """ def __init__(self, xserver_name, xserver_config, logger=None, loglevel=log.loglevel_DEFAULT): """\ @@ -320,6 +328,7 @@ class X2GoXServer(threading.Thread): """\ Start this L{X2GoXServer} thread. This will launch the configured XServer application. + """ self._keepalive = True cmd_line = [self.xserver_config['run_command']] @@ -349,6 +358,7 @@ class X2GoXServer(threading.Thread): """\ Terminate the runnint XServer process. + """ self.logger('terminating running XServer ,,%s\'\'' % self.xserver_name, loglevel=log.loglevel_DEBUG) @@ -362,6 +372,7 @@ class X2GoXServer(threading.Thread): """\ A call to this method will stop the XServer application and do a cleanup afterwards. + """ self._keepalive = False self.logger('stop_thread() method has been called', loglevel=log.loglevel_DEBUG) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git