Commit ad16bbaf authored by Nicolas Wavrant's avatar Nicolas Wavrant

recipe-zeroknown: updating buildout parameters resets config section

(better in development purposes)
parent c9868a24
...@@ -58,19 +58,25 @@ class WriteRecipe(GenericBaseRecipe): ...@@ -58,19 +58,25 @@ class WriteRecipe(GenericBaseRecipe):
self.parser.write(file) self.parser.write(file)
# If the file or section do not exist # If the file or section do not exist
except ConfigParser.NoSectionError, IOError: except ConfigParser.NoSectionError, IOError:
self.full_install() self.install()
install = update = lambda self: []
def install(self):
def full_install(self): """XXX-Nicolas : when some parameter's value is changed in
buildout profile, this will override custom user defined values"""
self.parser.read(self.path) self.parser.read(self.path)
if self.parser.has_section(self.name):
self.parser.remove_section(self.name)
self.parser.add_section(self.name) self.parser.add_section(self.name)
for key in self.options: for key in self.options:
self.parser.set(self.name, key, self.options[key]) self.parser.set(self.name, key, self.options[key])
with open(self.path, 'w') as file: with open(self.path, 'w') as file:
self.parser.write(file) self.parser.write(file)
def update(self):
pass
class ReadRecipe(GenericBaseRecipe): class ReadRecipe(GenericBaseRecipe):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment