]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/config.py
Feat(config): getlist
[m_librarian.git] / m_librarian / config.py
index cbf76b7aab2c8e168ae734d6b09f8055519c181d..b4a7b603d23d0fe06c4c693fb5081f0b29f9b6ad 100755 (executable)
@@ -63,6 +63,18 @@ class ConfigWrapper(object):
             return default
         # Do not catch ValueError here, it must be propagated
 
+    def getlist(self, section, option, default=None, sep=None):
+        value = self.get(section, option)
+        if not value:
+            if default is None:
+                return []
+            return default
+        return value.split(sep)
+
+    def getpath(self, section, option, default=os.path.curdir):
+        path = self.get(section, option, default=default)
+        return os.path.expanduser(os.path.expandvars(path))
+
 
 def get_config(config_path=None):
     global _ml_config