mirror of
https://github.com/beetbox/beets.git
synced 2026-01-08 00:45:55 +01:00
Improve comments on formatting inner workings
This commit is contained in:
parent
065cb59ce7
commit
3787f8a1dd
2 changed files with 6 additions and 0 deletions
|
|
@ -229,6 +229,8 @@ class WriteError(FileOperationError):
|
|||
class LibModel(dbcore.Model):
|
||||
"""Shared concrete functionality for Items and Albums.
|
||||
"""
|
||||
_format_config_key = None
|
||||
"""Config key that specifies how an instance should be formatted"""
|
||||
|
||||
def _template_funcs(self):
|
||||
funcs = DefaultTemplateFunctions(self, self._db).functions()
|
||||
|
|
@ -252,6 +254,7 @@ class LibModel(dbcore.Model):
|
|||
spec = beets.config[self._format_config_key].get(unicode)
|
||||
result = self.evaluate_template(spec)
|
||||
if isinstance(spec, bytes):
|
||||
# if spec is a byte string then we must return a one as well
|
||||
return result.encode('utf8')
|
||||
else:
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -97,6 +97,9 @@ def print_(*strings):
|
|||
"""Like print, but rather than raising an error when a character
|
||||
is not in the terminal's encoding's character set, just silently
|
||||
replaces it.
|
||||
|
||||
If the arguments are strings then they're expected to share the same type:
|
||||
either bytes or unicode.
|
||||
"""
|
||||
if strings:
|
||||
if not isinstance(strings[0], basestring):
|
||||
|
|
|
|||
Loading…
Reference in a new issue