replace: tolerate None replacements

Avoids confusion/traceback when you leave off the replacement string instead
of using ''.
This commit is contained in:
Adrian Sampson 2013-11-25 21:52:46 -08:00
parent bc660ec47f
commit cf3af711da
2 changed files with 6 additions and 2 deletions

View file

@ -463,13 +463,15 @@ def get_replacements():
"""
replacements = []
for pattern, repl in config['replace'].get(dict).items():
repl = repl or ''
try:
replacements.append((re.compile(pattern), repl))
except re.error:
raise UserError(
u'malformed regular expression in replace: {0}'.format(
pattern
))
)
)
return replacements
def get_plugin_paths():

View file

@ -63,11 +63,13 @@ Little fixes:
Mathijs de Bruin.
* The :ref:`clutter` option can now be a whitespace-separated list in addition
to a YAML list.
* Values for the :ref:`replace` option can now be empty (i.e., null is
equivalent to the empty string).
.. _Acoustic Attributes: http://developer.echonest.com/acoustic-attributes.html
.. _MPD: http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki
1.3.1 (October 12, 2013)
------------------------