Package entropy :: Module core :: Class SystemSettings

Class SystemSettings

source code


This is the place where all the Entropy settings are stored if they are not considered instance constants (etpConst). For example, here we store package masking cache information and settings, client-side, server-side and services settings. Also, this class mimics a dictionary (even if not inheriting it due to development choices).

Sample code:

>>> from entropy.core import SystemSettings
>>> system_settings = SystemSettings()
>>> system_settings.clear()
>>> system_settings.destroy()
Instance Methods
 
init_singleton(self)
Replaces __init__ because SystemSettings is a Singleton.
source code
None
destroy(self)
Overloaded method from Singleton.
source code
None
add_plugin(self, system_settings_plugin_instance)
This method lets you add custom parsers to SystemSettings.
source code
None
remove_plugin(self, plugin_id)
This method lets you remove previously added custom parsers from SystemSettings through its plugin identifier.
source code
 
__setitem__(self, mykey, myvalue)
dict method.
source code
 
__getitem__(self, mykey)
dict method.
source code
 
__delitem__(self, mykey)
dict method.
source code
 
__iter__(self)
dict method.
source code
 
__contains__(self, item)
dict method.
source code
 
__cmp__(self, other)
dict method.
source code
 
__hash__(self)
dict method.
source code
 
__len__(self)
dict method.
source code
 
get(self, mykey, alt_obj=None)
dict method.
source code
 
has_key(self, mykey)
dict method.
source code
 
copy(self)
dict method.
source code
 
fromkeys(self, seq, val=None)
dict method.
source code
 
items(self)
dict method.
source code
 
iteritems(self)
dict method.
source code
 
iterkeys(self)
dict method.
source code
 
keys(self)
dict method.
source code
 
pop(self, mykey, default=None)
dict method.
source code
 
popitem(self)
dict method.
source code
 
setdefault(self, mykey, default=None)
dict method.
source code
 
update(self, kwargs)
dict method.
source code
 
values(self)
dict method.
source code
 
clear(self)
dict method.
source code
None
set_persistent_setting(self, persistent_dict)
Make metadata persistent, the input dict will be merged with the base one at every reset call (clear()).
source code
None
unset_persistent_setting(self, persistent_key)
Remove dict key from persistent dictionary
source code
dict
get_setting_files_data(self)
Return a copy of the internal *files* dictionary.
source code
None
validate_entropy_cache(self, settingfile, mtimefile, repoid=None)
Internal method.
source code

Inherited from Singleton: is_destroyed, is_singleton

Inherited from object: __delattr__, __getattribute__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods

Inherited from Singleton: __new__

Properties

Inherited from object: __class__

Method Details

init_singleton(self)

source code 

Replaces __init__ because SystemSettings is a Singleton. see Singleton API reference for more information.

destroy(self)

source code 

Overloaded method from Singleton. "Destroys" the instance.

Returns: None
None

add_plugin(self, system_settings_plugin_instance)

source code 

This method lets you add custom parsers to SystemSettings. Mind that you are responsible of handling your plugin instance and remove it before it is destroyed. You can remove the plugin instance at any time by issuing remove_plugin. Every add_plugin or remove_plugin method will also issue clear() for you. This could be bad and it might be removed in future.

Parameters:
  • plugin_id (string) - plugin identifier
  • system_settings_plugin_instance (SystemSettingsPlugin instance) - valid SystemSettingsPlugin instance
Returns: None
None

remove_plugin(self, plugin_id)

source code 

This method lets you remove previously added custom parsers from SystemSettings through its plugin identifier. If plugin_id is not available, KeyError exception will be raised. Every add_plugin or remove_plugin method will also issue clear() for you. This could be bad and it might be removed in future.

Parameters:
  • plugin_id (basestring) - plugin identifier
Returns: None
None

__setitem__(self, mykey, myvalue)
(Index assignment operator)

source code 

dict method. See Python dict API reference.

__getitem__(self, mykey)
(Indexing operator)

source code 

dict method. See Python dict API reference.

__delitem__(self, mykey)
(Index deletion operator)

source code 

dict method. See Python dict API reference.

__iter__(self)

source code 

dict method. See Python dict API reference.

__contains__(self, item)
(In operator)

source code 

dict method. See Python dict API reference.

__cmp__(self, other)
(Comparison operator)

source code 

dict method. See Python dict API reference.

__hash__(self)
(Hashing function)

source code 

dict method. See Python dict API reference.

Overrides: object.__hash__

__len__(self)
(Length operator)

source code 

dict method. See Python dict API reference.

get(self, mykey, alt_obj=None)

source code 

dict method. See Python dict API reference.

has_key(self, mykey)

source code 

dict method. See Python dict API reference.

copy(self)

source code 

dict method. See Python dict API reference.

fromkeys(self, seq, val=None)

source code 

dict method. See Python dict API reference.

items(self)

source code 

dict method. See Python dict API reference.

iteritems(self)

source code 

dict method. See Python dict API reference.

iterkeys(self)

source code 

dict method. See Python dict API reference.

keys(self)

source code 

dict method. See Python dict API reference.

pop(self, mykey, default=None)

source code 

dict method. See Python dict API reference.

popitem(self)

source code 

dict method. See Python dict API reference.

setdefault(self, mykey, default=None)

source code 

dict method. See Python dict API reference.

update(self, kwargs)

source code 

dict method. See Python dict API reference.

values(self)

source code 

dict method. See Python dict API reference.

clear(self)

source code 

dict method. See Python dict API reference. Settings are also re-initialized here.

@return None

set_persistent_setting(self, persistent_dict)

source code 

Make metadata persistent, the input dict will be merged with the base one at every reset call (clear()).

Parameters:
  • persistent_dict (dict) - dictionary to merge
Returns: None
None

unset_persistent_setting(self, persistent_key)

source code 

Remove dict key from persistent dictionary

Parameters:
  • persistent_key - key to remove
  • persistent_dict (dict)
Returns: None
None

get_setting_files_data(self)

source code 

Return a copy of the internal *files* dictionary. This dict contains config file paths and their identifiers.

Returns: dict
dict __setting_files

validate_entropy_cache(self, settingfile, mtimefile, repoid=None)

source code 

Internal method. Validates Entropy Cache based on a setting file and its stored (cache bound) mtime.

Parameters:
  • settingfile (string) - path of the setting file
  • mtimefile (string) - path where to save retrieved mtime information
  • repoid (string or None) - repository identifier or None
Returns: None
None