method instead of nested function

This commit is contained in:
meejah 2020-05-07 15:44:25 -06:00
parent c9f5ed7d64
commit 7cb7cdfac9

View File

@ -276,18 +276,20 @@ class _Config(object):
self.config = configparser
if write_new_tahoecfg is None:
def write_new_tahoecfg(config):
write_new_tahoecfg = self._default_write_new_tahoecfg
self._write_config = write_new_tahoecfg
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
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, <basedir>/tahoe.cfg
"""
fn = os.path.join(self._basedir, "tahoe.cfg")
with open(fn, "w") as f:
config.write(f)
self._write_config = write_new_tahoecfg
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
self.nickname = nickname_utf8.decode("utf-8")
assert type(self.nickname) is unicode
def validate(self, valid_config_sections):
configutil.validate_config(self._config_fname, self.config, valid_config_sections)