lower case in config file
This commit is contained in:
@@ -49,6 +49,7 @@ def error(out):
|
||||
|
||||
def getConfig(filename):
|
||||
"""reads filename as config, checks for DEST parameter and returns cfgfile object"""
|
||||
ret = None
|
||||
try:
|
||||
ret = cfgfile.Conf(filename)
|
||||
except:
|
||||
@@ -57,19 +58,19 @@ def getConfig(filename):
|
||||
# try
|
||||
|
||||
# check for DEST parameter
|
||||
if not ret.check("Main", "DEST"):
|
||||
if not ret.check("Main", "dest"):
|
||||
error("No DEST in config file %s" % filename)
|
||||
return False
|
||||
# if no DEST
|
||||
|
||||
# replace $HOME with real home directory
|
||||
if ret.get("Main", "DEST") == "$HOME":
|
||||
ret.set("Main", "DEST", os.environ['HOME'])
|
||||
if ret.get("Main", "dest") == "$HOME":
|
||||
ret.set("Main", "dest", os.environ['HOME'])
|
||||
# if $HOME
|
||||
|
||||
# make sure DEST ends with /
|
||||
if not ret.get("Main", "DEST").endswith("/"):
|
||||
ret.set("Main", "DEST", ret.get("Main", "DEST")+"/")
|
||||
if not ret.get("Main", "dest").endswith("/"):
|
||||
ret.set("Main", "dest", ret.get("Main", "dest")+"/")
|
||||
# if not /
|
||||
|
||||
return ret
|
||||
@@ -123,7 +124,7 @@ def userConfigGenerated(filename, cfg):
|
||||
return False
|
||||
# if not filename
|
||||
|
||||
if not cfg.check("Main","STAMP"):
|
||||
if not cfg.check("Main","stamp"):
|
||||
# no STAMP in userconfig.cfg, so no way to check if file was generated by userconfig
|
||||
return False
|
||||
# no STAMP
|
||||
@@ -131,7 +132,7 @@ def userConfigGenerated(filename, cfg):
|
||||
fp = open(filename, "r")
|
||||
|
||||
for line in fp:
|
||||
if re.search(re.escape(cfg.get("Main","STAMP")), line):
|
||||
if re.search(re.escape(cfg.get("Main","stamp")), line):
|
||||
return True
|
||||
# if search
|
||||
# for line
|
||||
|
Reference in New Issue
Block a user