Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10559/TMDA
Modified Files:
ChangeLog Defaults.py
Log Message:
Add two improvements from Stephen Warren:
- bugfix: If variables named in _path_vars weren't defined at all,
Defaults.py would throw an exception.
- If TMDARC isn't specified in the environment (i.e, the '-c' option
wasn't used), allow GLOBAL_TMDARC to specify the location of TMDARC
before defaulting to ~/.tmda/config.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -r1.313 -r1.314
--- ChangeLog 21 Feb 2004 01:09:20 -0000 1.313
+++ ChangeLog 1 Mar 2004 19:02:10 -0000 1.314
@@ -1,3 +1,8 @@
+2004-03-01 Jason R. Mastaler <jasonrm@xxxxxxxxxxxxxxxxxxxxxxxx>
+
+ * Defaults.py (TMDARC): Allow TMDARC to be specified by
+ GLOBAL_TMDARC if $TMDARC is not set.
+
2004-02-20 Jason R. Mastaler <jason@xxxxxxxxxxxx>
* Defaults.py: Removed BOUNCE_TEXT_* and CONFIRM_ACCEPT_TEXT_* in
Index: Defaults.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Defaults.py,v
retrieving revision 1.201
retrieving revision 1.202
diff -u -r1.201 -r1.202
--- Defaults.py 21 Feb 2004 01:09:20 -0000 1.201
+++ Defaults.py 1 Mar 2004 19:02:11 -0000 1.202
@@ -65,25 +65,31 @@
progpath = os.path.normpath(progdir + '/' + linkpath)
PARENTDIR = os.path.split(os.path.dirname(progpath))[0] # '../'
-# If the file /etc/tmdarc exists, read it before ~/.tmda/config.
-# Make site-wide configuration changes to this file.
-GLOBAL_TMDARC = '/etc/tmdarc'
-if os.path.exists(GLOBAL_TMDARC):
- execfile(GLOBAL_TMDARC)
-
-# Look for the user-config-file in the environment first then default
-# to ~/.tmda/config
-TMDARC = os.environ.get('TMDARC')
-if not TMDARC:
+# Look for the global config file in the environment first, and then
+# default to /etc/tmdarc. If one exists, read it before TMDARC. Make
+# site-wide configuration changes to this file.
+GLOBAL_TMDARC = os.environ.get('GLOBAL_TMDARC')
+if not GLOBAL_TMDARC:
+ GLOBAL_TMDARC = '/etc/tmdarc'
+ if os.path.exists(GLOBAL_TMDARC):
+ execfile(GLOBAL_TMDARC)
+
+# Look for the user config file in the TMDARC environment var first,
+# and if not there, then check if set by GLOBAL_TMDARC, and finally
+# default to ~/.tmda/config
+_tmdarc = os.environ.get('TMDARC')
+if _tmdarc:
+ TMDARC = _tmdarc
+elif not vars().has_key('TMDARC'):
TMDARC = os.path.expanduser('~/.tmda/config')
-
+
# CONFIG_EXEC
-# If set to 0 in GLOBAL_TMDARC, the user's TMDARC file will be parsed
+# If set to False in GLOBAL_TMDARC, the user's TMDARC file will be parsed
# using ConfigParser, otherwise it will evaluated as a sequence of
# Python statements using execfile().
-# Default is 1 (execfile())
+# Default is True (use execfile())
if not vars().has_key('CONFIG_EXEC'):
- CONFIG_EXEC = 1
+ CONFIG_EXEC = True
# Read-in the user's configuration file.
if os.path.exists(TMDARC):
@@ -1567,7 +1573,7 @@
_defaults = globals()
for var in _path_vars:
- if isinstance(_defaults[var], str):
+ if _defaults.has_key(var) and isinstance(_defaults[var], str):
_defaults[var] = os.path.expanduser(_defaults[var])
|