From 7cb7cdfac90a45e9c3fcc5de35cbc93f7d96b805 Mon Sep 17 00:00:00 2001 From: meejah Date: Thu, 7 May 2020 15:44:25 -0600 Subject: [PATCH] method instead of nested function --- src/allmydata/node.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/allmydata/node.py b/src/allmydata/node.py index f2f52d323..ae62e2fc3 100644 --- a/src/allmydata/node.py +++ b/src/allmydata/node.py @@ -276,19 +276,21 @@ class _Config(object): self.config = configparser if write_new_tahoecfg is None: - def write_new_tahoecfg(config): - """ - Write to the default place, /tahoe.cfg - """ - fn = os.path.join(self._basedir, "tahoe.cfg") - with open(fn, "w") as f: - config.write(f) + write_new_tahoecfg = self._default_write_new_tahoecfg self._write_config = write_new_tahoecfg nickname_utf8 = self.get_config("node", "nickname", "") self.nickname = nickname_utf8.decode("utf-8") assert type(self.nickname) is unicode + def _default_write_new_tahoecfg(self, config): + """ + Write to the default place, /tahoe.cfg + """ + fn = os.path.join(self._basedir, "tahoe.cfg") + with open(fn, "w") as f: + config.write(f) + def validate(self, valid_config_sections): configutil.validate_config(self._config_fname, self.config, valid_config_sections)