config: Support UTF-8 in default config
Fixes issue reported at https://discuss.mopidy.com/t/428. Mopidy-HTTP-Kuechenradio includes a non-ASCII UTF-8 character in its default config. If Mopidy didn't already have a config file, it crashed when trying to create the initial config file based on the default config of all available extensions.
This commit is contained in:
parent
aa3b8ab5f8
commit
fcf39833ca
@ -10,6 +10,12 @@ v0.19.5 (UNRELEASED)
|
||||
|
||||
Bug fix release.
|
||||
|
||||
- config: Support UTF-8 in default config. If an extension with non-ASCII
|
||||
characters in its default config was installed, and Mopidy didn't already
|
||||
have a config file, Mopidy would crashed when trying to create the initial
|
||||
config file based on the default config of all available extensions.
|
||||
(Fixes: :discuss:`428`)
|
||||
|
||||
- Models: Hide empty collections from :func:`repr()` representations.
|
||||
|
||||
- Models: Field values are no longer stored on the model instance when the
|
||||
|
||||
@ -97,8 +97,12 @@ def format_initial(extensions):
|
||||
versions = ['Mopidy %s' % versioning.get_version()]
|
||||
for extension in sorted(extensions, key=lambda ext: ext.dist_name):
|
||||
versions.append('%s %s' % (extension.dist_name, extension.version))
|
||||
description = _INITIAL_HELP.strip() % {'versions': '\n# '.join(versions)}
|
||||
return description + '\n\n' + _format(config, {}, schemas, False, True)
|
||||
|
||||
header = _INITIAL_HELP.strip() % {'versions': '\n# '.join(versions)}
|
||||
formatted_config = _format(
|
||||
config=config, comments={}, schemas=schemas,
|
||||
display=False, disable=True).decode('utf-8')
|
||||
return header + '\n\n' + formatted_config
|
||||
|
||||
|
||||
def _load(files, defaults, overrides):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user