diff options
Diffstat (limited to 'grc/blocks/variable_config.xml')
-rw-r--r-- | grc/blocks/variable_config.xml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/grc/blocks/variable_config.xml b/grc/blocks/variable_config.xml index f62a3def1..1c815c347 100644 --- a/grc/blocks/variable_config.xml +++ b/grc/blocks/variable_config.xml @@ -11,14 +11,16 @@ <import>import ConfigParser</import> <var_make>self._$(id)_config = ConfigParser.ConfigParser() self._$(id)_config.read($config_file) -if not self._$(id)_config.has_section($section): - self._$(id)_config.add_section($section) try: $(id) = self._$(id)_config.$(type.get)($section, $option) except: $(id) = $value self.$(id) = $(id)</var_make> <make></make> <callback>self.set_$(id)($value)</callback> - <callback>self._$(id)_config.set($section, $option, str($writeback)) + <callback>self._$(id)_config = ConfigParser.ConfigParser() +self._$(id)_config.read($config_file) +if not self._$(id)_config.has_section($section): + self._$(id)_config.add_section($section) +self._$(id)_config.set($section, $option, str($writeback)) self._$(id)_config.write(open($config_file, 'w'))</callback> <param> <name>Default Value</name> |