The branch, twofactorauth has been updated via 2e0232b4b3d86428f40ffa9baec29624422fd690 (commit) from 99ade314aa7312a33aeb8d6d6327a395fa0de6b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: x2go/client.py | 437 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 337 insertions(+), 100 deletions(-) The diff of changes is: diff --git a/x2go/client.py b/x2go/client.py index 2c69158..7b80471 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -393,7 +393,7 @@ class X2goClient(object): def HOOK_check_host_dialog(self, profile_name='UNKNOWN', host='UNKNOWN', port=22, fingerprint='no fingerprint', fingerprint_type='RSA'): """\ - HOOK method: called if a host check is requested. This hook has to either return C{true} (default) or C{false}. + 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 @type profile_name: C{str} @@ -405,7 +405,7 @@ class X2goClient(object): @type fingerprint: C{str} @param fingerprint_type: finger print type (like RSA, DSA, ...) @type fingerprint_type: C{str} - @return: if host validity is verified, the hook method should return C{true} + @return: if host validity is verified, the hook method should return C{True} @rtype: C{bool} """ @@ -665,23 +665,46 @@ class X2goClient(object): self.printing_backend = eval('printing.%s' % _classname) def get_client_rootdir(self): + """\ + Retrieve the root dir for settings of this L{X2goClient} instance. + + @return: X2go client root directory + @rtype: C{str} + """ return self.client_rootdir __get_client_rootdir = get_client_rootdir @property def has_custom_client_rootdir(self): + """\ + Does this L{X2goClient} instance have a customized root dir path? + Returns C{True} in case it has. + + """ return self._has_custom_client_rootdir __has_custom_client_rootdir = has_custom_client_rootdir def get_sessions_rootdir(self): + """\ + Retrieve the sessions root dir of this L{X2goClient} instance. + + @return: X2go sessions root directory + @rtype: C{str} + """ return self.sessions_rootdir __get_sessions_rootdir = get_sessions_rootdir def get_ssh_rootdir(self): + """\ + Retrieve the SSH client root dir used with this L{X2goClient} instance. + + @return: SSH client root directory + @rtype: C{str} + """ return self.ssh_rootdir __get_ssh_rootdir = get_ssh_rootdir - def __get_client_username(self): + def get_client_username(self): """\ Query the local user's username (i.e. the user running the X2go client). @@ -690,11 +713,11 @@ class X2goClient(object): """ return _CURRENT_LOCAL_USER - get_client_username = __get_client_username + __get_client_username = get_client_username def register_all_session_profiles(self, return_objects=False): """\ - Register all session profiles found in the C{sessions} configuration file + Register all session profiles found in the C{sessions} configuration node as potential X2go sessions. @param return_objects: if set to C{True} this methods returns a list of L{X2goSession} @@ -721,30 +744,30 @@ class X2goClient(object): add_to_known_hosts=False, known_hosts=None, return_object=False, **kwargs): """\ - Register a new X2go client session. Within one X2goClient + Register a new X2go client session. Within one L{X2goClient} instance you can manage several sessions on serveral remote X2go servers under different user names. - These sessions can have been instantiated by passing direct X2goSession - parameters to this method or by naming a session profile. + These sessions can be instantiated by passing direct L{X2goSession} + parameters to this method or by naming a session profile. - A profile is - a pre-defined set of session options stored in a sessions - profile file (i.e. a configuration file). Normally such session profiles are - stored in C{~/.x2goclient/sessions} or globally (for all users on the + A profile is a pre-defined set of session options stored in a sessions + profile node (i.e. a configuration file). With the FILE backend such session + profiles are stored in C{~/.x2goclient/sessions} or globally (for all users on the client) in C{/etc/x2goclient/sessions}. - Of coures, Python X2go supports starting multiple X2go sessions from the same + Python X2go also supports starting multiple X2go sessions from the same session profile simultaneously. This method (L{X2goClient.register_session()}) accepts a similar set of parameters - as the L{X2goSession} constructor itself. + as the L{X2goSession} constructor itself. For a complete set of session options refer + there. Alternatively, you can also pass a profile name or a profile id - to this method. When this is done, Python X2go tries to find the specified session - in the C{sessions} configuration and then derives the necessary session parameters - from the session's profile configuration. Additional L{X2goSession} parameters can - also be passed to this method, they will override the option values retrieved from + to this method. If you do this, Python X2go tries to find the specified session + in the C{sessions} configuration node and then derives the necessary session parameters + from the session profile configuration. Additional L{X2goSession} parameters can + 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 @@ -762,6 +785,17 @@ class X2goClient(object): @param share_local_folders: a list of local folders (as strings) to be shared directly after session start up @type share_local_folders: C{list} + @param allow_mimebox: enable X2go MIME box support for the to-be-registered X2go session + @type allow_mimebox: C{bool} + @param mimebox_extensions: MIME box support is only allowed for the given file extensions + @type mimebox_extensions: C{list} + @param mimebox_action: MIME box action to use on incoming MIME job files + @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 + @type add_to_known_hosts: C{bool} + @param known_hosts: full path to C{known_hosts} file + @type known_hosts: C{str} @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 @@ -845,7 +879,10 @@ class X2goClient(object): def get_session_summary(self, session_uuid): """\ - STILL UNDOCUMENTED + Retrieves a Python dictionary, containing a short session summary (session status, names, etc.) + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} """ return self.session_registry.session_summary(session_uuid) @@ -856,8 +893,8 @@ class X2goClient(object): def get_session_username(self, session_uuid): """\ - After an X2go session has been set up you can query the - username the remote sessions runs as. + After an X2go session has been set up you can query the + username that the remote sessions runs as. @param session_uuid: the X2go session's UUID registry hash @type session_uuid: C{str} @@ -871,8 +908,8 @@ class X2goClient(object): def get_session_server_peername(self, session_uuid): """\ - After a session has been set up you can query the - hostname of the host the session is connected to (or + After a session has been set up you can query the + hostname of the host the session is connected to (or about to connect to). @param session_uuid: the X2go sessions UUID registry hash @@ -905,17 +942,9 @@ class X2goClient(object): def get_session(self, session_uuid): """\ - Retrieve the complete L{X2goSession} object that has been + Retrieve the complete L{X2goSession} object that has been registered under the given session registry hash. - NOTE: This method exist mainly for debugging and internal use. The returned - L{X2goSession} class is not a Python X2go public API class. - If you use it in your applications, note that method names and - options or syntax might change in the future. - - To retrieve a public API based session object, use the - L{get_session()}. - @param session_uuid: the X2go session's UUID registry hash @type session_uuid: C{str} @@ -945,7 +974,16 @@ class X2goClient(object): def set_session_username(self, session_uuid, username): """\ - STILL UNDOCUMENTED + Set the session username for the session that has been registered under C{session_uuid}. + This can be helpful for modifying user credentials during an authentication phase. + + @param session_uuid: the X2go session's UUID registry hash + @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 + @rtype: C{bool} """ return self.session_registry(session_uuid).set_username(username=username) @@ -954,6 +992,12 @@ class X2goClient(object): """\ Provide a mechanism to evaluate the validity of an X2go server host. + @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. + @rtype: C{bool} + """ return self.session_registry(session_uuid).check_host() __check_session_host = check_session_host @@ -972,11 +1016,17 @@ 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 + @type username: C{str} @param password: the user's password for the X2go server that is going to be connected to @type password: C{str} + @param sshproxy_user: user name to be used for SSH proxy authentication + @type sshproxy_user: C{str} + @param sshproxy_password: the SSH proxy user's password + @type sshproxy_password: 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 as missing-host-key-policy. If set to C{False} checkhosts.X2goInteractiveAddPolicy() is used @type add_to_known_hosts: C{bool} @param force_password_auth: disable SSH pub/priv key authentication mechanisms @@ -1013,7 +1063,7 @@ class X2goClient(object): If X2go client-side printing is enable within an X2go session you can use this method to alter the way how incoming print spool jobs are handled/processed. - Currently, there are four different print actions available, each defined as an individual + Currently, there are five different print actions available, each defined as an individual print action class: - B{PDFVIEW} (L{X2goPrintActionPDFVIEW}): view an incoming spool job (a PDF file) @@ -1099,15 +1149,15 @@ class X2goClient(object): """\ Suspend an X2go session. - Normally you will use this method to suspend a registered session that you + Normally, you will use this method to suspend a registered session that you have formerly started/resumed from within your recent - X2goClient instance. For this you simply call this method + L{X2goClient} instance. For this you simply call this method using the sessions C{session_uuid}, leave the C{session_name} empty. Alternatively, you can suspend a non-associated X2go session: - To do this you simply neeed to register (L{register_session}) - an X2go session on the to-be-addressed remote X2go server and + To do this you simply neeed to register (with the L{register_session} + method) an X2go session on the to-be-addressed remote X2go server and connect (L{connect_session}) to it. Then call this method with the freshly obtained C{session_uuid} and the remote X2go session name (as shown e.g. in x2golistsessions output). @@ -1138,11 +1188,11 @@ class X2goClient(object): def terminate_session(self, session_uuid, session_name=None): """\ - Terminate an X2go session. + Terminate an X2go session. Normally you will use this method to terminate a registered session that you have formerly started/resumed from within your recent - X2goClient instance. For this you simply call this method + L{X2goClient} instance. For this you simply call this method using the sessions C{session_uuid}, leave the C{session_name} empty. @@ -1153,10 +1203,6 @@ class X2goClient(object): the freshly obtained C{session_uuid} and the remote X2go session name (as shown in e.g. x2golistsessions output). - Or you can terminate a non-attached session by simply - registering an X2go server session and then passing the - server-side X2go session name to this method. - @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 @@ -1183,14 +1229,14 @@ class X2goClient(object): def get_session_profile_name(self, session_uuid): """\ Retrieve the profile name of the session that has been registered - under C{session_uuid}. + under C{session_uuid}. - For profile based sessions this will be the profile named as used + For profile based sessions this will be the profile name as used in x2goclient's »sessions« configuration file. For non-profile based session this will either be a C{profile_name} that was passed to L{register_session} or it will be the application that - instantiated this X2goClient object. + instantiated this L{X2goClient} instance. @param session_uuid: the X2go session's UUID registry hash @type session_uuid: C{str} @@ -1205,14 +1251,14 @@ class X2goClient(object): def get_session_profile_id(self, session_uuid): """\ Retrieve the profile id of the session that has been registered - under C{session_uuid}. + under C{session_uuid}. For profile based sessions this will be the profile id as used - in x2goclient's »sessions« configuration file (section header of - a session profile in the config, normally a time stamp created on + in x2goclient's »sessions« configuration node (section header of + a session profile in the config, normally a timestamp created on session profile creation/modification). - For non-profile based session this will be a timestamp created on + For non-profile based sessions this will be a timestamp created on X2go session registration by C{register_session}. @param session_uuid: the session profile name @@ -1242,8 +1288,8 @@ class X2goClient(object): def is_session_connected(self, session_uuid): """\ - Test if the X2go session registered as C{session_uuid} is - Paramiko/SSH connected. + Test if the X2go session registered as C{session_uuid} connected + to the X2go server. @param session_uuid: the X2go session's UUID registry hash @type session_uuid: C{str} @@ -1262,6 +1308,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 + @type session_name: C{str} @return: C{True} if session is running, C{False} otherwise @rtype: C{bool} @@ -1280,6 +1328,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 + @type session_name: C{str} @return: C{True} if session is suspended, C{False} otherwise @rtype: C{bool} @@ -1298,6 +1348,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 + @type session_name: C{str} @return: C{True} if session has terminated, C{False} otherwise @rtype: C{bool} @@ -1322,6 +1374,8 @@ class X2goClient(object): @param folder_name: the full path to an existing folder on the local (client-side) file system @type folder_name: C{str} + @param profile_name: alternatively, the profile name can be used to share local folders + @type profile_name: C{str} @return: returns C{True} if the local folder has been successfully mounted @rtype: C{bool} @@ -1344,7 +1398,18 @@ class X2goClient(object): def client_connected_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve a list of X2go sessions that this L{X2goClient} instance is connected to. + + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_profile_names: return as list of session profile names + @type return_profile_names: C{bool} + @param return_profile_ids: return as list of session profile IDs + @type return_profile_ids: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of connected sessions + @rtype: C{list} """ return self.session_registry.connected_sessions(return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids, return_session_names=return_session_names) @@ -1353,7 +1418,7 @@ class X2goClient(object): @property def client_has_connected_sessions(self): """\ - STILL UNDOCUMENTED + Equals C{True} if there are any connected sessions with this L{X2goClient} instance. """ return self.session_registry.has_connected_sessions @@ -1361,7 +1426,18 @@ class X2goClient(object): def client_associated_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve a list of X2go sessions associated to this L{X2goClient} instance. + + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_profile_names: return as list of session profile names + @type return_profile_names: C{bool} + @param return_profile_ids: return as list of session profile IDs + @type return_profile_ids: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of associated sessions + @rtype: C{list} """ return self.session_registry.associated_sessions(return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids, return_session_names=return_session_names) @@ -1370,7 +1446,7 @@ class X2goClient(object): @property def client_has_associated_sessions(self): """\ - STILL UNDOCUMENTED + Equals C{True} if there are any associated sessions with this L{X2goClient} instance. """ return self.session_registry.has_associated_sessions @@ -1378,7 +1454,18 @@ class X2goClient(object): def client_running_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve a list of running X2go sessions. + + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_profile_names: return as list of session profile names + @type return_profile_names: C{bool} + @param return_profile_ids: return as list of session profile IDs + @type return_profile_ids: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of running sessions + @rtype: C{list} """ return self.session_registry.running_sessions(return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids, return_session_names=return_session_names) @@ -1387,7 +1474,7 @@ class X2goClient(object): @property def client_has_running_sessions(self): """\ - STILL UNDOCUMENTED + Equals C{True} if there are any running sessions with this L{X2goClient} instance. """ return self.session_registry.has_running_sessions @@ -1395,7 +1482,18 @@ class X2goClient(object): def client_suspended_sessions(self, return_objects=False, return_profile_names=False, return_profile_ids=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve a list of suspended X2go sessions. + + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_profile_names: return as list of session profile names + @type return_profile_names: C{bool} + @param return_profile_ids: return as list of session profile IDs + @type return_profile_ids: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of suspended sessions + @rtype: C{list} """ return self.session_registry.running_sessions(return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids, return_session_names=return_session_names) @@ -1404,7 +1502,7 @@ class X2goClient(object): @property def client_has_suspended_sessions(self): """\ - STILL UNDOCUMENTED + Equals C{True} if there are any suspended sessions with this L{X2goClient} instance. """ return self.session_registry.has_suspended_sessions @@ -1413,7 +1511,18 @@ class X2goClient(object): @property def client_registered_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve a list of registered X2go sessions. + + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_profile_names: return as list of session profile names + @type return_profile_names: C{bool} + @param return_profile_ids: return as list of session profile IDs + @type return_profile_ids: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of registered sessions + @rtype: C{list} """ return self.session_registry.registered_sessions(return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids, return_session_names=return_session_names) @@ -1422,7 +1531,10 @@ class X2goClient(object): @property def client_control_sessions(self): """\ - STILL UNDOCUMENTED + Retrieve a list of all registered X2go control sessions. + + @return: list of all registered control sessions + @rtype: C{list} """ return self.session_registry.control_sessions @@ -1430,7 +1542,12 @@ class X2goClient(object): def client_control_session_of_profile_name(self, profile_name): """\ - STILL UNDOCUMENTED + Retrieve control session for profile name <profile_name>. + + @param profile_name: profile name + @type profile_name: C{str} + @return: control session instance + @rtype: C{X2goControlSession*} instance """ return self.session_registry.control_session_of_profile_name(profile_name) @@ -1438,7 +1555,12 @@ class X2goClient(object): def client_registered_session_of_name(self, session_name, return_object=False): """\ - STILL UNDOCUMENTED + Retrieve X2go session of a given session name. + + @param session_name: session name + @type session_name: C{str} + @return: control session instance + @rtype: C{X2goSession} or C{str} """ return self.session_registry.get_session_of_session_name(session_name, return_object=return_object) @@ -1446,7 +1568,10 @@ class X2goClient(object): def client_has_registered_session_of_name(self, session_name): """\ - STILL UNDOCUMENTED + Equals C{True} if there is a registered session of name <session_name>. + + @param session_name: session name + @type session_name: C{str} """ return self.client_registered_session_of_name(session_name) is not None @@ -1454,24 +1579,48 @@ class X2goClient(object): def client_registered_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve registered X2go sessions of profile name <profile_name>. + @param profile_name: profile name + @type profile_name: C{str} + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of registered sessions of profile name + @rtype: C{list} """ return self.session_registry.registered_sessions_of_profile_name(profile_name, return_objects=return_objects, return_session_names=return_session_names) __client_registered_sessions_of_profile_name = client_registered_sessions_of_profile_name def client_connected_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve connected X2go sessions of profile name <profile_name>. + @param profile_name: profile name + @type profile_name: C{str} + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of connected sessions of profile name + @rtype: C{list} """ return self.session_registry.connected_sessions_of_profile_name(profile_name, return_objects=return_objects, return_session_names=return_session_names) __client_connected_sessions_of_profile_name = client_connected_sessions_of_profile_name def client_associated_sessions_of_profile_name(self, profile_name, return_objects=False, return_session_names=False): """\ - STILL UNDOCUMENTED + Retrieve associated X2go sessions of profile name <profile_name>. + @param profile_name: profile name + @type profile_name: C{str} + @param return_objects: return as list of X2go session objects + @type return_objects: C{bool} + @param return_session_names: return as list of session names + @type return_session_names: C{bool} + @return: list of associated sessions of profile name + @rtype: C{list} """ return self.session_registry.associated_sessions_of_profile_name(profile_name, return_objects=return_objects, return_session_names=return_session_names) __client_associated_sessions_of_profile_name = client_associated_sessions_of_profile_name @@ -1484,6 +1633,10 @@ class X2goClient(object): """\ Test if server that corresponds to the terminal session C{session_uuid} is alive. + @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} """ try: return self.session_registry(session_uuid).is_alive() @@ -1496,8 +1649,10 @@ class X2goClient(object): def all_servers_are_alive(self): """\ - STILL UNDOCUMENTED + Test vitality of all connected X2go servers. + @return: C{True} if all connected X2go servers are alive. + @rtype: C{bool} """ _all_alive = True for session_uuid in self.client_connected_sessions(): @@ -1508,7 +1663,11 @@ class X2goClient(object): """\ Check if user is allowed to start an X2go session on a remote server. - @return:C Remote user allowed to start an X2go session? + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} + @param username: user name to test validity for + @type username: C{str} + @return: Is remote user allowed to start an X2go session? @rtype: C{str} """ @@ -1517,7 +1676,13 @@ class X2goClient(object): def server_running_sessions(self, session_uuid): """\ - STILL UNDOCUMENTED + Retrieve a list of session names of all server-side running sessions (including those not + instantiated by our L{X2goClient} instance). + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} + @return: list of session names + @rtype: C{list} """ if self._X2goClient__is_session_connected(session_uuid): @@ -1530,7 +1695,10 @@ class X2goClient(object): @property def server_has_running_sessions(self, session_uuid): """\ - STILL UNDOCUMENTED + Equals C{True} if the X2go server has any running sessions. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} """ return len(self._X2goClient__server_running_sessions(session_uuid)) > 0 @@ -1539,14 +1707,25 @@ class X2goClient(object): @property def server_has_running_session_of_name(self, session_uuid, session_name): """\ - STILL UNDOCUMENTED + Equals C{True} if the X2go server has a running session of name <session_name>. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} + @param session_name: session name + @type session_name: C{str} """ return session_name in self._X2goClient__server_running_sessions(session_uuid) def server_suspended_sessions(self, session_uuid): """\ - STILL UNDOCUMENTED + Retrieve a list of session names of all server-side suspended sessions (including those not + instantiated by our L{X2goClient} instance). + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} + @return: list of session names + @rtype: C{list} """ if self._X2goClient__is_session_connected(session_uuid): @@ -1557,9 +1736,12 @@ class X2goClient(object): __server_suspended_sessions = server_suspended_sessions @property - def server_has_suspended_sessions(self): + def server_has_suspended_sessions(self, session_uuid): """\ - STILL UNDOCUMENTED + Equals C{True} if the X2go server has any suspended sessions. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} """ return len(self._X2goClient__server_suspended_sessions(session_uuid)) > 0 @@ -1567,7 +1749,12 @@ class X2goClient(object): @property def server_has_suspended_session_of_name(self, session_uuid, session_name): """\ - STILL UNDOCUMENTED + Equals C{True} if the X2go server has a suspended session of name <session_name>. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} + @param session_name: session name + @type session_name: C{str} """ return session_name in self._X2goClient__server_suspended_sessions(session_uuid) @@ -1578,8 +1765,8 @@ class X2goClient(object): def clean_sessions(self, session_uuid): """\ - Find running X2go sessions that have previously been started by the - connected user on the remote X2go server and terminate them. + Find running X2go sessions that have previously been started by the + connected user on the remote X2go server and terminate them. Before calling this method you have to setup a pro forma remote X2go session with L{X2goClient.register_session()} (even if you do not intend to open @@ -1602,7 +1789,7 @@ class X2goClient(object): raw=False): """\ Use the X2go session registered under C{session_uuid} to - retrieve a list of running or suspended X2go sessions on the + retrieve a list of running or suspended X2go sessions from the connected X2go server (for the authenticated user). Before calling this method you have to setup a pro forma remote X2go session @@ -1612,6 +1799,23 @@ class X2goClient(object): @param session_uuid: the X2go session's UUID registry hash @type session_uuid: C{str} + @param profile_name: use profile name instead of <session_uuid> + @type profile_name: C{str} + @param profile_id: use profile id instead of <profile_name> or <session_uuid> + @type profile_id: C{str} + @param no_cache: do not get the session list from cache, query the X2go server directly + @type no_cache: C{bool} + @param refresh_cache: query the X2go server directly and update the session list cache + with the new information + @type refresh_cache: C{bool} + @param update_sessionregistry: query the X2go server directly and update the + session registry according to the obtained information + @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 + @type register_sessions: C{bool} + @param raw: output the session list in X2go's raw C{x2golistsessions} format + @type raw: C{bool} """ if profile_id is not None: @@ -1666,7 +1870,7 @@ class X2goClient(object): Returns the L{X2goClient} instance's L{X2goSessionProfiles} object. Use this method for object retrieval if you want to modify the »sessions« - configuration file in ~/.x2goclient (default location) from within your + configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2go based application. """ @@ -1679,7 +1883,7 @@ class X2goClient(object): @property def profile_names(self): """\ - STILL UNDOCUMENTED + Equals a list of all profile names that are known to this L{X2goClient} instance. """ return self.session_profiles.profile_names @@ -1689,7 +1893,7 @@ class X2goClient(object): Returns the L{X2goClient} instance's L{X2goClientSettings} object. Use this method for object retrieval if you want to modify the »settings« - configuration file in ~/.x2goclient (default location) from within your + configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2go based application. """ @@ -1701,7 +1905,7 @@ class X2goClient(object): Returns the L{X2goClient} instance's L{X2goClientPrinting} object. Use this method for object retrieval if you want to modify the printing - configuration file in ~/.x2goclient (default location) from within your + configuration node (e.g. in ~/.x2goclient with the FILE backend) from within your Python X2go based application. """ @@ -1731,13 +1935,13 @@ class X2goClient(object): def to_profile_id(self, profile_name): """\ - Retrieve the session profile id of the session whose profile name + Retrieve the session profile ID of the session whose profile name is C{profile_name} @param profile_name: the session profile name @type profile_name: C{str} - @return: the session profile's id + @return: the session profile's ID @rtype: C{str} """ @@ -1746,10 +1950,10 @@ class X2goClient(object): def to_profile_name(self, profile_id): """\ - Retrieve the session profile name of the session whose profile id + Retrieve the session profile name of the session whose profile ID is C{profile_id} - @param profile_id: the session profile id + @param profile_id: the session profile ID @type profile_id: C{str} @return: the session profile's name @@ -1769,13 +1973,19 @@ class X2goClient(object): @return: the profile's meta type @rtype: C{str} + """ return self.session_profiles.get_profile_metatype(profile_name) __get_profile_metatype = get_profile_metatype def client_connected_profiles(self, return_profile_names=False): """\ - STILL UNDOCUMENTED + 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 + @type return_profile_names: C{bool} + @return: a list of profile names or IDs + @rtype: C{list} """ if return_profile_names: @@ -1791,6 +2001,9 @@ class X2goClient(object): @param profile_name: the X2go session profile name @type profile_name: C{str} + @return: a return value + @rtype: C{bool} + """ _retval = False for s in self.session_registry.registered_sessions_of_profile_name(profile_name, return_objects=True): @@ -1802,7 +2015,12 @@ class X2goClient(object): def update_sessionregistry_status_by_profile_name(self, profile_name, session_list=None): """\ - STILL UNDOCUMENTED + Update the session registry stati by profile name. + + @param profile_name: the X2go session profile name + @type profile_name: C{str} + @param session_list: a manually passed on list of X2go sessions + @type profile_name: C{X2goServerInfo*} instances """ session_uuids = self.client_registered_sessions_of_profile_name(profile_name, return_objects=False) @@ -1822,7 +2040,11 @@ class X2goClient(object): def update_sessionregistry_status_by_session_uuid(self, session_uuid): """\ - STILL UNDOCUMENTED + Update the session registry status of a specific L{X2goSession} instance with + session identifier <session_uuid>. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} """ session_list = self.list_sessions(session_uuid, update_sessionregistry=False, register_sessions=False) @@ -1832,7 +2054,7 @@ class X2goClient(object): def update_sessionregistry_status_all_profiles(self): """\ - STILL UNDOCUMENTED + Update the session registry stati of all session profiles. """ for profile_name in self.client_connected_profiles(return_profile_names=True): @@ -1842,7 +2064,10 @@ class X2goClient(object): def update_cache_by_profile_name(self, profile_name): """\ - STILL UNDOCUMENTED + Update the list sessions cache by profile name. + + @param profile_name: the X2go session profile name + @type profile_name: C{str} """ if self.listsessions_cache is not None: @@ -1855,7 +2080,11 @@ class X2goClient(object): def update_cache_by_session_uuid(self, session_uuid): """\ - STILL UNDOCUMENTED + Update the list sessions cache of a specific L{X2goSession} instance with + session identifier <session_uuid>. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} """ profile_name = self.get_session_profile_name(session_uuid) @@ -1864,7 +2093,7 @@ class X2goClient(object): def update_cache_all_profiles(self): """\ - STILL UNDOCUMENTED + Update the list sessions cache of all session profiles. """ if self.listsessions_cache is not None: @@ -1876,7 +2105,11 @@ class X2goClient(object): def register_available_server_sessions_by_profile_name(self, profile_name): """\ - STILL UNDOCUMENTED + Register available sessions that are found on the X2go server the profile + of name C{<profile_name>} is connected to. + + @param profile_name: the X2go session profile name + @type profile_name: C{str} """ for profile_name in self.client_connected_profiles(return_profile_names=True): @@ -1893,7 +2126,11 @@ class X2goClient(object): def register_available_server_sessions_by_session_uuid(self, session_uuid): """\ - STILL UNDOCUMENTED + Register available sessions that are found on the X2go server that the L{X2goSession} instance + with session identifier <session_uuid> is connected to. + + @param session_uuid: the X2go session's UUID registry hash + @type session_uuid: C{str} """ profile_name = self.get_session_profile_name(session_uuid) @@ -1902,7 +2139,7 @@ class X2goClient(object): def register_available_server_sessions_all_profiles(self): """\ - STILL UNDOCUMENTED + Register all available sessions found on an X2go server for each session profile. """ for profile_name in self.client_connected_profiles(return_profile_names=True): hooks/post-receive -- python-x2go.git (Python X2Go Client API) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "python-x2go.git" (Python X2Go Client API).