[CONFIG] Automatically absolute-ize directories
authorIra W. Snyder <devel@irasnyder.com>
Tue, 26 Dec 2006 23:52:57 +0000 (15:52 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Tue, 26 Dec 2006 23:52:57 +0000 (15:52 -0800)
This patch makes the RarslaveConfig class automatically return the absolute
paths to directories, even though they are not stored in the config that
way.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
RarslaveConfig.py

index 527d976..f4a2988 100644 (file)
@@ -100,12 +100,16 @@ class RarslaveConfig (object):
                        # into the code, so DON'T DO IT
                        value = self.__get_default_val(section, key)
 
-               # Convert config options to booleans for easier use
+               # Convert config options to native types for easier use
                SAFE_EVAL = ['None', 'True', 'False', '-1', '0', '1', '2']
 
                if value in SAFE_EVAL:
                        value = eval (value)
 
+               # Absolute-ize directories for easier use
+               if section == 'directories':
+                       value = os.path.abspath (os.path.expanduser (value))
+
                return value
 
        def __init__(self):