def read(self, filenames=None): # Load FI config with open(utils.fixpath(self.fi_config)) as fi_config: self.read_file(fi_config) # Then load user configs (defaults to fi.cfg [global] config: value) filenames = filenames or utils.fixpath(self.get("global", "config")) return ConfigParser.read(self, filenames)
def test_all(self): """ utils.fixpath() calls os.path.{expanduser, normpath, normcase, abspath} """ test_path = "~/foo/../bar" home = os.environ["HOME"] self.assertEqual(fixpath(test_path), "{}/bar".format(home))
def read(self, filenames=None): # Load FI config self.readfp(open(fixpath(self.fi_config))) # Then load user configs (defaults to fi.cfg [global] config: value) filenames = filenames or fixpath(self.get('global', 'config')) return SafeConfigParser.read(self, filenames)
# coding: utf-8 # stdlib imports import os # local imports from ofxtools import utils __all__ = ["CONFIGDIR", "USERCONFIGDIR"] CONFIGDIR = utils.fixpath(os.path.dirname(__file__)) # Cross-platform specification of user configuration directory if "APPDATA" in os.environ: # Windows CONFIGHOME = os.environ["APPDATA"] elif "XDG_CONFIG_HOME" in os.environ: # Linux CONFIGHOME = os.environ["XDG_CONFIG_HOME"] else: CONFIGHOME = os.path.join(os.environ["HOME"], ".config") USERCONFIGDIR = os.path.join(utils.fixpath(CONFIGHOME), "ofxtools")