Package x2go :: Package backends :: Package profiles :: Module _file :: Class X2goSessionProfilesFILE
[frames] | no frames]

Class X2goSessionProfilesFILE

source code

          object --+    
                   |    
inifiles.X2goIniFile --+
                       |
                      X2goSessionProfilesFILE

Instance Methods
 
__init__(self, config_files=['/home/buildd/.x2goclient/sessions', '/etc/x2goclient/sessions'], defaults=None, session_profile_defaults=None, logger=None, loglevel=56)
Retrieve X2Go session profiles from a file, typically ~/.x2goclient/sessions.
source code
dict
__call__(self, profile_id_or_name)
Retrieve the session profile configuration for a given session profile ID (or name)
source code
str
get_profile_metatype(self, profile_id_or_name, force=False)
Detect a human readable session profile type from the session profile configuration.
source code
type
get_profile_option_type(self, option)
Get the data type for a specific session profile option.
source code
type
get_type(self, section, key)
Override the parent class's get_type method due to the special layout of this class.
source code
dict
get_profile_config(self, profile_id_or_name=None, profile_id=None)
The configuration options for a single session profile.
source code
dict
default_profile_config(self)
Return a default session profile.
source code
bool
has_profile(self, profile_id_or_name)
Does a session profile of a given profile ID or profile name exist?
source code
bool
has_profile_id(self, profile_id)
Does a session profile of a given profile ID exist? (Faster than has_profile().)
source code
bool
has_profile_name(self, profile_name)
Does a session profile of a given profile name exist? (Faster than has_profile().)
source code
str
to_profile_id(self, profile_name)
Convert profile name to profile ID.
source code
str
to_profile_name(self, profile_id)
Convert profile ID to profile name.
source code
str
add_profile(self, profile_id=None, **kwargs)
Add a new session profile.
source code
 
delete_profile(self, profile_id_or_name)
Delete a session profile from the configuration file.
source code
 
update_value(self, section, key, value)
Update a value in a session profile.
source code
str
check_profile_id_or_name(self, profile_id_or_name)
Detect the profile ID from a given string which maybe profile ID or profile name.
source code
dict
to_session_params(self, profile_id_or_name=None, profile_id=None)
Convert session profile options to X2goSession constructor method parameters.
source code
depends on the session profile option requested
get_session_param(self, profile_id_or_name, param)
Get a single X2goSession parameter from a specific session profile.
source code

Inherited from inifiles.X2goIniFile: __repr__, get, get_value, load, write

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  defaultSessionProfile = {'applications': ['WWWBROWSER', 'MAILC...

Inherited from inifiles.X2goIniFile: defaultValues, user_config_file, write_user_config

Properties
  profile_ids
Renders a list of all profile IDs found in the session profile configuration file.
  profile_names
Renders a list of all profile names found in the session profile configuration file.

Inherited from inifiles.X2goIniFile: printable_config_file

Inherited from object: __class__

Method Details

__init__(self, config_files=['/home/buildd/.x2goclient/sessions', '/etc/x2goclient/sessions'], defaults=None, session_profile_defaults=None, logger=None, loglevel=56)
(Constructor)

source code 

Retrieve X2Go session profiles from a file, typically ~/.x2goclient/sessions.

Parameters:
  • config_files (list) - 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
  • defaults (dict) - not used for this class
  • session_profile_defaults (dict) - a default session profile
  • logger (X2goLogger instance) - you can pass an X2goLogger object to the X2goSessionProfilesFILE constructor
  • loglevel (int) - if no X2goLogger object has been supplied a new one will be constructed with the given loglevel
Overrides: object.__init__

__call__(self, profile_id_or_name)
(Call operator)

source code 

Retrieve the session profile configuration for a given session profile ID (or name)

Parameters:
  • profile_id_or_name (str) - profile ID or profile name
Returns: dict
the profile ID's / name's profile configuration
Overrides: inifiles.X2goIniFile.get_value

get_profile_metatype(self, profile_id_or_name, force=False)

source code 

Detect a human readable session profile type from the session profile configuration.

Parameters:
  • profile_id_or_name (str) - profile ID or profile name
  • force (bool) - re-detect the meta type, otherwise use a cached result
Returns: str
the profile ID's / name's meta type

get_profile_option_type(self, option)

source code 

Get the data type for a specific session profile option.

Parameters:
  • option (will be detected by this method) - the option to get the data type for
Returns: type
the data type of option

get_type(self, section, key)

source code 

Override the parent class's get_type method due to the special layout of this class.

Parameters:
  • section (str) - INI file section
  • key (str) - key in INI file section
Returns: type
the data type of key in section
Overrides: inifiles.X2goIniFile.get_type

get_profile_config(self, profile_id_or_name=None, profile_id=None)

source code 

The configuration options for a single session profile.

Parameters:
  • profile_id_or_name (str) - either profile ID or profile name is accepted
  • profile_id (str) - profile ID (fast than specifying profile_id_or_name)
Returns: dict
the session profile configuration for the given profile ID (or name)

default_profile_config(self)

source code 

Return a default session profile.

Returns: dict
default session profile

has_profile(self, profile_id_or_name)

source code 

Does a session profile of a given profile ID or profile name exist?

Parameters:
  • profile_id_or_name (str) - profile ID or profile name
Returns: bool
True if there is such a session profile, False otherwise

has_profile_id(self, profile_id)

source code 

Does a session profile of a given profile ID exist? (Faster than has_profile().)

Parameters:
  • profile_id (str) - profile ID
Returns: bool
True if there is such a session profile, False otherwise

has_profile_name(self, profile_name)

source code 

Does a session profile of a given profile name exist? (Faster than has_profile().)

Parameters:
  • profile_name (str) - profile name
Returns: bool
True if there is such a session profile, False otherwise

to_profile_id(self, profile_name)

source code 

Convert profile name to profile ID.

Parameters:
  • profile_name (str) - profile name
Returns: str
profile ID

to_profile_name(self, profile_id)

source code 

Convert profile ID to profile name.

Parameters:
  • profile_id (str) - profile ID
Returns: str
profile name

add_profile(self, profile_id=None, **kwargs)

source code 

Add a new session profile.

Parameters:
  • profile_id (str) - a custom profile ID--if left empty a profile ID will be auto-generated
  • kwargs (dict) - session profile options for this new session profile
Returns: str
the (auto-generated) profile ID of the new session profile

delete_profile(self, profile_id_or_name)

source code 

Delete a session profile from the configuration file.

Parameters:
  • profile_id_or_name (str) - profile ID or profile name

update_value(self, section, key, value)

source code 

Update a value in a session profile.

Parameters:
  • section (str) - the profile ID
  • key (str) - the session profile option of the given profile ID
  • value (any type, depends on the session profile option) - the value to update the session profile option with
Overrides: inifiles.X2goIniFile.update_value

check_profile_id_or_name(self, profile_id_or_name)

source code 

Detect the profile ID from a given string which maybe profile ID or profile name.

Parameters:
  • profile_id_or_name (str) - profile ID or profile name
Returns: str
profile ID
Raises:

to_session_params(self, profile_id_or_name=None, profile_id=None)

source code 

Convert session profile options to X2goSession constructor method parameters.

Parameters:
  • profile_id_or_name (str) - either profile ID or profile name is accepted
  • profile_id (str) - profile ID (fast than specifying profile_id_or_name)
Returns: dict
a dictionary of X2goSession constructor method parameters

get_session_param(self, profile_id_or_name, param)

source code 

Get a single X2goSession parameter from a specific session profile.

Parameters:
  • profile_id_or_name (str) - either profile ID or profile name is accepted
  • param (str) - the parameter name in the X2goSession constructor method
Returns: depends on the session profile option requested
the value of the session profile option represented by param

Class Variable Details

defaultSessionProfile

Value:
{'applications': ['WWWBROWSER', 'MAILCLIENT', 'OFFICE', 'TERMINAL'],
 'autologin': False,
 'autostart': False,
 'command': 'TERMINAL',
 'defsndport': True,
 'dpi': 96,
 'export': '',
 'fstunnel': True,
...

Property Details

profile_ids

Renders a list of all profile IDs found in the session profile configuration file.

Get Method:
unreachable.profile_ids(self) - Renders a list of all profile IDs found in the session profile configuration file.

profile_names

Renders a list of all profile names found in the session profile configuration file.

Get Method:
unreachable.profile_names(self) - Renders a list of all profile names found in the session profile configuration file.