khard.config module

Loading and validation of the configuration file

class khard.config.Config(config_file=None)

Bases: object

SPEC_FILE = '/build/khard-iATsBd/khard-0.15.0/khard/data/config.spec'
load_address_books()
merge(other)

Merge the config with some other dict or ConfigObj

Parameters:other – the other dict or ConfigObj to merge into self
Returns:None
supported_vcard_versions = ('3.0', '4.0')
khard.config.exit(message, prefix='Error in config file\n')

Exit with a message and a return code indicating an error in the config file.

This function doesn’t return, it calls sys.exit.

Parameters:
  • message (str) – the message to print
  • prefix (str) – the prefix to put in front of the message
Returns:

does not return

khard.config.validate_action(value)

Check that the given value is a valid action.

Parameters:value – the config value to check
Returns:the same value
Return type:str
Raises:validate.ValidateError
khard.config.validate_command(value)

Special validator to check shell commands

The input must either be a list of strings or a string that shlex.split can parse into such.

Parameters:value – the config value to validate
Returns:the command after validation
Return type:list(str)
Raises:validate.ValidateError
khard.config.validate_private_objects(value)

Check that the private objects are reasonable

Parameters:value – the config value to check
Returns:the list of private objects
Return type:list(str)
Raises:validate.ValidateError