Changeset 1828


Ignore:
Timestamp:
06/12/06 14:31:15 (11 years ago)
Author:
spascoe
Message:

Changed config reading rules. You can now set NDG_HOME to override $HOME/.ndg.
This will be useful for making test fixtures, among other things.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI00-utils/trunk/ndg/utils/config.py

    r1816 r1828  
    1212    the config file currently being parsed. 
    1313 2. /etc/ndg.conf is read if available 
    14  3. $HOME/.ndg/ndg.conf is read if available 
    15  
     14 3. $NDG_HOME/ndg.conf is read if available. 
     15 4. NDG_HOME defaults to $HOME/.ndg if unset. 
     16  
    1617For example: 
    1718 
     
    7576 
    7677config = NdgConfigParser(CONFIG_SECTION) 
    77 config.read([GLOBAL_CONFIG_FILE, '%s/.ndg/ndg.conf' % os.getenv('HOME')]) 
     78NDG_HOME = os.getenv('NDG_HOME', os.path.join(os.getenv('HOME'), '.ndg')) 
     79config.read([GLOBAL_CONFIG_FILE, os.path.join(NDG_HOME, 'ndg.conf')]) 
    7880 
Note: See TracChangeset for help on using the changeset viewer.