From 9a6b6240d0befaa2efd5578e9d3a3ce5a539109d Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 1 Jun 2013 17:28:59 -0700 Subject: [PATCH] zero: fix nulling fields containing None --- beetsplug/zero.py | 3 ++- docs/changelog.rst | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/beetsplug/zero.py b/beetsplug/zero.py index ef0b8b28d..1ea6d0e50 100644 --- a/beetsplug/zero.py +++ b/beetsplug/zero.py @@ -89,6 +89,7 @@ class ZeroPlugin(BeetsPlugin): continue self._log.debug(u'[zero] \"{0}\" ({1}) match: {2}' .format(fval, fn, ' '.join(patterns))) - setattr(item, fn, type(fval)()) + new_val = None if fval is None else type(fval)() + setattr(item, fn, new_val) self._log.debug(u'[zero] {0}={1}' .format(fn, getattr(item, fn))) diff --git a/docs/changelog.rst b/docs/changelog.rst index eeeb78d86..f602ca744 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -47,6 +47,8 @@ Changelog that go missing. * The :ref:`modify-cmd` command can now change albums' album art paths (i.e., ``beet modify artpath=...`` works). Thanks to Lucas Duailibe. +* :doc:`/plugins/zero`: Fix a crash when nulling out a field that contains + None. * Various UI enhancements to the importer due to Tai Lee: * More consistent format and colorization of album and track metadata.