toolsutils.py
changeset 5021 58e89f3dfbae
parent 4721 8f63691ccb7f
child 5184 955ee1b24756
--- a/toolsutils.py	Thu Mar 25 14:33:50 2010 +0100
+++ b/toolsutils.py	Thu Mar 25 17:55:24 2010 +0100
@@ -184,7 +184,7 @@
                 config_file, ex)
     return config
 
-def env_path(env_var, default, name):
+def env_path(env_var, default, name, checkexists=True):
     """get a path specified in a variable or using the default value and return
     it.
 
@@ -203,8 +203,8 @@
     :raise `ConfigurationError`: if the returned path does not exist
     """
     path = environ.get(env_var, default)
-    if not exists(path):
-        raise ConfigurationError('%s path %s doesn\'t exist' % (name, path))
+    if checkexists and not exists(path):
+        raise ConfigurationError('%s directory %s doesn\'t exist' % (name, path))
     return abspath(path)