summaryrefslogtreecommitdiff
path: root/python/skytools/config.py
diff options
context:
space:
mode:
authorMarko Kreen2009-04-27 19:49:46 +0000
committerMarko Kreen2009-04-28 12:03:02 +0000
commit5f4a184ba7562d2c15d77281172f76f58037275b (patch)
tree96d94ab02144b9ebef379f565caf4bd60dc4cd32 /python/skytools/config.py
parentf2d8830120a4cb2de550345beff8cc4b96ebef9b (diff)
skytools.Config: use config file name as default job_name
Diffstat (limited to 'python/skytools/config.py')
-rw-r--r--python/skytools/config.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/skytools/config.py b/python/skytools/config.py
index fbe0b6ed..a39f4087 100644
--- a/python/skytools/config.py
+++ b/python/skytools/config.py
@@ -1,7 +1,7 @@
"""Nicer config class."""
-import os, ConfigParser, socket
+import os, os.path, ConfigParser, socket
__all__ = ['Config']
@@ -18,8 +18,12 @@ class Config(object):
@param sane_config: chooses between ConfigParser/SafeConfigParser.
"""
+ # use config file name as default job_name
+ job_name = os.path.splitext(os.path.basename(filename))[0]
+
+ # initialize defaults, make them usable in config file
defs = {
- 'job_name': main_section,
+ 'job_name': job_name,
'service_name': main_section,
'host_name': socket.gethostname(),
}