The branch, twofactorauth has been updated via c5da60f5a9943d8216572c73d1e0d4bf5c669aaf (commit) from 63c93d1376cf14bfc549ecdb33189212d3c1dc0b (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/registry.py | 140 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 77 insertions(+), 63 deletions(-) The diff of changes is: diff --git a/x2go/registry.py b/x2go/registry.py index e541ba4..85216eb 100644 --- a/x2go/registry.py +++ b/x2go/registry.py @@ -18,7 +18,7 @@ # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. """\ -X2goSessionRegistry class - managing x2goclient session profiles. +X2goSessionRegistry class - the X2goClient's session registry backend """ __NAME__ = 'x2gosessregistry-pylib' @@ -47,15 +47,15 @@ class X2goRegisteredSession(object): result += p + '=' + str(self.__dict__[p]) + ', ' return result + ')' - def __get_uuid(self): + def get_uuid(self): """\ STILL UNDOCUMENTED """ return self.uuid - get_uuid = __get_uuid + __get_uuid = get_uuid - def __get_username(self): + def get_username(self): """\ After a session has been setup up you can query the username the sessions runs as. @@ -65,9 +65,9 @@ class X2goRegisteredSession(object): """ return self.session_object.get_transport().get_username() - get_username = __get_username + __get_username = get_username - def __get_server(self): + def get_server(self): """\ After a session has been setup up you can query the hostname of the host the sessions is connected to (or @@ -79,9 +79,9 @@ class X2goRegisteredSession(object): """ return self.session_object.get_transport().getpeername() - get_server = __get_server + __get_server = get_server - def __get_session_name(self): + def get_session_name(self): """\ Retrieve the server-side X2go session name for the session that has been registered under C{profile_id}. @@ -91,9 +91,9 @@ class X2goRegisteredSession(object): """ return self.session_object.session_info - get_session_name = __get_session_name + __get_session_name = get_session_name - def __connect(self, password=None, add_to_known_hosts=False, force_password_auth=False): + def connect(self, password=None, add_to_known_hosts=False, force_password_auth=False): """\ Connect to a registered X2go session with registry hash C{<session_uuid>}. This method basically wraps around paramiko.SSHClient.connect() for the @@ -114,11 +114,11 @@ class X2goRegisteredSession(object): connect_options = self.connect_options connect_options['password'] = password connect_options['force_password_auth'] = force_password_auth - self.session_object.connect(self.server, **connect_options) - self.connected = True - connect = __connect + self.connected = self.session_object.connect(self.server, **connect_options) + return self.connected + __connect = connect - def __set_print_action(self, session_uuid, print_action, **kwargs): + def set_print_action(self, session_uuid, print_action, **kwargs): """\ STILL UNDOCUMENTED @@ -126,34 +126,37 @@ class X2goRegisteredSession(object): if type(print_action) is not types.StringType: return False self.session_object.set_print_action(print_action, **kwargs) - set_print_action = __set_print_action + __set_print_action = set_print_action - def __start(self): + def start(self): """\ Start a new X2go session on the remote X2go server. """ session = self.session_object - session.start() + if session.start(): - if session.params.snd_system is not 'none': - session.start_sound() + if session.params.snd_system is not 'none': + session.start_sound() - session.start_sshfs() - if self.printing: - session.start_printing() + session.start_sshfs() + if self.printing: + session.start_printing() - if self.share_local_folders: - if session.get_transport().reverse_tunnels['sshfs'][1] is not None: - for _folder in self.share_local_folders: - session.share_local_folder(_folder) + if self.share_local_folders: + if session.get_transport().reverse_tunnels['sshfs'][1] is not None: + for _folder in self.share_local_folders: + session.share_local_folder(_folder) - session.run_command() - self.running = True - start = __start + session.run_command() + self.running = True + return True - def __resume(self, session_name): + return False + __start = start + + def resume(self, session_name): """\ Resume or continue a suspended / running X2go session on the remote X2go server. @@ -163,19 +166,22 @@ class X2goRegisteredSession(object): """ self.session_object.associate(session_name) - self.session_object.resume() + if self.session_object.resume(): + + if self.session_object.params.snd_system is not 'none': + self.session_object.start_sound() - if self.session_object.params.snd_system is not 'none': - self.session_object.start_sound() + self.session_object.start_sshfs() + if self.printing: + session.start_printing() - self.session_object.start_sshfs() - if self.printing: - session.start_printing() + self.running = True + return True - self.running = True - resume = __resume + return False + __resume = resume - def __suspend(self): + def suspend(self): """\ Suspend an X2go session. @@ -187,12 +193,16 @@ class X2goRegisteredSession(object): server-side X2go session name to this method. """ - self.session_object.suspend() - self.running = False - self.suspended = True - suspend = __suspend + if self.session_object.suspend(): + + self.running = False + self.suspended = True + return True - def __terminate(self): + return False + __suspend = suspend + + def terminate(self): """\ Terminate an X2go session. @@ -204,13 +214,17 @@ class X2goRegisteredSession(object): server-side X2go session name to this method. """ - self.session_object.terminate() - self.running = False - self.suspended = False - self.terminated = True - terminate = __terminate + if self.session_object.terminate(): + + self.running = False + self.suspended = False + self.terminated = True + return True + + return False + __terminate = terminate - def __get_profile_name(self): + def get_profile_name(self): """\ Retrieve the profile name of the session that has been registered under C{session_hash} @@ -224,9 +238,9 @@ class X2goRegisteredSession(object): """ return self.profile_name - get_profile_name = __get_profile_name + __get_profile_name = get_profile_name - def __get_profile_id(self): + def get_profile_id(self): """\ Retrieve the session profile id of the session whose profile name is C{profile_name} @@ -239,13 +253,13 @@ class X2goRegisteredSession(object): """ return self.profile_id - get_profile_id = __get_profile_id + __get_profile_id = get_profile_id ### ### QUERYING INFORMATION ### - def __session_ok(self): + def session_ok(self): """\ Test if the X2go session registered as C{session_uuid} is in a healthy state. @@ -258,9 +272,9 @@ class X2goRegisteredSession(object): """ return self.session_object.ok() - session_ok = __session_ok + __session_ok = session_ok - def __is_running(self): + def is_running(self): """\ Test if the X2go session registered as C{session_uuid} is up and running. @@ -270,9 +284,9 @@ class X2goRegisteredSession(object): """ return self.session_object.is_running() - is_running = __is_running + _is_running = is_running - def __is_suspended(self): + def is_suspended(self): """\ Test if the X2go session registered as C{session_uuid} is in suspended state. @@ -282,9 +296,9 @@ class X2goRegisteredSession(object): """ return self.session_object.is_suspended() - is_suspended = __is_suspended + __is_suspended = is_suspended - def __has_terminated(self): + def has_terminated(self): """\ Test if the X2go session registered as C{session_uuid} has terminated. @@ -294,9 +308,9 @@ class X2goRegisteredSession(object): """ return self.session_object.has_terminated() - has_terminated = __has_terminated + __has_terminated = has_terminated - def __share_local_folder(self, folder_name): + def share_local_folder(self, folder_name): """\ Share a local folder with the X2go session registered as C{session_uuid}. @@ -310,7 +324,7 @@ class X2goRegisteredSession(object): """ return self.session_object.share_local_folder(folder_name=folder_name) - share_local_folder = __share_local_folder + __share_local_folder = share_local_folder class X2goSessionRegistry(object): 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).