mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-03 03:36:44 +00:00
method instead of nested function
This commit is contained in:
parent
c9f5ed7d64
commit
7cb7cdfac9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user