securecrt_tools.settings

SettingsImporter

class securecrt_tools.settings.SettingsImporter(settings_file, create=False)

A class to handle validating, retrieving and updating settings as needed.

validate_settings()

A method to check if the user’s settings.ini file contains all of the correct settings.

Returns:A boolean describing if the user’s settings file is valid
Return type:bool
correct_settings()

A method to update the user’s settings file to match the current correct version while carrying over current values to the new file. Adds anything in defaults that isn’t in the user’s settings to the settings.ini file. This does not remove any additions that may have been added to the user’s configuration file.

get(section, setting)

A wrapper function to simplify the retrieval of an individual setting.

Parameters:
  • section (str) – The section of the settings file where the setting can be found.
  • setting (str) – The name of the setting we want to retrieve
Returns:

The value of the setting requested

Return type:

str

update(section, setting, value)

A wrapper function to update a setting

Parameters:
  • section (str) – The section of the settings file where the setting can be found.
  • setting (str) – The name of the setting we want to retrieve
  • value (str) – The value to store for this setting
getboolean(section, setting)

A wrapper function to simplify the retrieval of an individual setting as a boolean value.

Parameters:
  • section (str) – The section of the settings file where the setting can be found.
  • setting (str) – The name of the setting we want to retrieve
Returns:

The value of the setting requested as a boolean

Return type:

bool

getint(section, setting)

A wrapper function to simplify the retrieval of an individual setting as an integer.

Parameters:
  • section (str) – The section of the settings file where the setting can be found.
  • setting (str) – The name of the setting we want to retrieve
Returns:

The value of the setting requested as an integer

Return type:

int

getlist(section, setting)

A wrapper function to simplify the retrieval of an individual setting as a list. Requires the setting to be a comma separated list, with no quotations.

Parameters:
  • section (str) – The section of the settings file where the setting can be found.
  • setting (str) – The name of the setting we want to retrieve
Returns:

The value of the setting requested as a list.

Return type:

int