Package flumotion :: Package common :: Module xdg
[hide private]

Module xdg

source code

Simple XDG Base Directory Specification implementation.

See http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html

Currently only configuration files handling is implemented.

Functions [hide private]
 
config_home_path()
Get the path of the config directory, taking into account the XDG_CONFIG_HOME environment variable.
source code
 
config_read_path(name)
Get the path of the config file with the given name, taking into account the XDG_CONFIG_HOME and XDG_CONFIG_DIRS environment variables.
source code
 
config_write_path(name, mode='w')
Get file-like object for the config file with the given name, taking into account the XDG_CONFIG_HOME environment variable.
source code
Variables [hide private]
  APPLICATION = 'flumotion'
  __package__ = 'flumotion.common'
Function Details [hide private]

config_read_path(name)

source code 

Get the path of the config file with the given name, taking into account the XDG_CONFIG_HOME and XDG_CONFIG_DIRS environment variables.

Parameters:
  • name (str) - The name of the config file
Returns:
full path to the file or None if it does not exist

config_write_path(name, mode='w')

source code 

Get file-like object for the config file with the given name, taking into account the XDG_CONFIG_HOME environment variable. Create intermidient directories and the file itself according to the XDG Specification in case the file does not exist.

May raise EnvironmentError if the file or directories cannot be created.

Parameters:
  • name (str) - The name of the config file
  • mode (str) - The mode to use when opening the file, 'w' by default.
Returns:
a file-like object