mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 10:46:24 +00:00
method instead of nested function
This commit is contained in:
parent
c9f5ed7d64
commit
7cb7cdfac9
@ -276,19 +276,21 @@ class _Config(object):
|
|||||||
self.config = configparser
|
self.config = configparser
|
||||||
|
|
||||||
if write_new_tahoecfg is None:
|
if write_new_tahoecfg is None:
|
||||||
def write_new_tahoecfg(config):
|
write_new_tahoecfg = self._default_write_new_tahoecfg
|
||||||
"""
|
|
||||||
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
|
self._write_config = write_new_tahoecfg
|
||||||
|
|
||||||
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
|
nickname_utf8 = self.get_config("node", "nickname", "<unspecified>")
|
||||||
self.nickname = nickname_utf8.decode("utf-8")
|
self.nickname = nickname_utf8.decode("utf-8")
|
||||||
assert type(self.nickname) is unicode
|
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)
|
||||||
|
|
||||||
def validate(self, valid_config_sections):
|
def validate(self, valid_config_sections):
|
||||||
configutil.validate_config(self._config_fname, self.config, valid_config_sections)
|
configutil.validate_config(self._config_fname, self.config, valid_config_sections)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user