if filename:
try:
self.config.read(filename)
- except:
- print "normal read failed"
+ except ConfigParser.MissingSectionHeaderError:
if filename.endswith('.xml'):
self.load_xml(filename)
else:
- print "loading shell"
self.load_shell(filename)
self._files.append(filename)
self.set_attributes()
c = ConfigParser.ConfigParser()
c.read(config_file)
return True
- except:
+ except ConfigParser.MissingSectionHeaderError:
return False
# bash does not have the concept of NULL
if value:
option = "%s_%s" % (section.upper(), name.upper())
- if not value.isdigit() and not bool(value):
- value = "'%s'" % value
+ if bool(value) and not value.isdigit():
+ value = str(bool(value))
buf.write(option + "=" + value + os.linesep)
return buf.getvalue()
def output_xml(self, encoding = "utf-8"):
pass
- def output_variables(self):
+ def output_variables(self, encoding="utf-8"):
"""
Return list of all variable names.
"""