From 3a0ac96cc57b95843b823286cecb20bf424cf910 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 17 Dec 2012 15:08:48 -0800 Subject: [PATCH] zero: Unicode logging calls --- beetsplug/zero.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/beetsplug/zero.py b/beetsplug/zero.py index 9c22b6d2d..b1da9b9db 100644 --- a/beetsplug/zero.py +++ b/beetsplug/zero.py @@ -47,11 +47,11 @@ class ZeroPlugin(BeetsPlugin): def configure(self, config): if not config.has_section('zero'): - self._log.debug('[zero] plugin is not configured') + self._log.debug(u'[zero] plugin is not configured') return for f in ui.config_val(config, 'zero', 'fields', '').split(): if f not in ITEM_KEYS: - self._log.error('[zero] invalid field: {0}'.format(f)) + self._log.error(u'[zero] invalid field: {0}'.format(f)) else: self.fields.append(f) p = ui.config_val(config, 'zero', f, '').split() @@ -63,7 +63,7 @@ class ZeroPlugin(BeetsPlugin): def import_task_choice_event(self, task, config): """Listen for import_task_choice event.""" if task.choice_flag == action.ASIS and not self.warned: - self._log.warn('[zero] cannot zero in \"as-is\" mode') + self._log.warn(u'[zero] cannot zero in \"as-is\" mode') self.warned = True # TODO request write in as-is mode @@ -80,23 +80,24 @@ class ZeroPlugin(BeetsPlugin): def write_event(self, item): """Listen for write event.""" if not self.fields: - self._log.warn('[zero] no fields, nothing to do') + self._log.warn(u'[zero] no fields, nothing to do') return for fn in self.fields: try: fval = getattr(item, fn) except AttributeError: - self._log.error('[zero] no such field: {0}'.format(fn)) + self._log.error(u'[zero] no such field: {0}'.format(fn)) else: if not self.match_patterns(fval, self.patterns[fn]): - self._log.debug('[zero] \"{0}\" ({1}) not match: {2}' + self._log.debug(u'[zero] \"{0}\" ({1}) not match: {2}' .format(fval, fn, ' '.join(self.patterns[fn]))) continue - self._log.debug('[zero] \"{0}\" ({1}) match: {2}' + self._log.debug(u'[zero] \"{0}\" ({1}) match: {2}' .format(fval, fn, ' '.join(self.patterns[fn]))) setattr(item, fn, type(fval)()) - self._log.debug('[zero] {0}={1}'.format(fn, getattr(item, fn))) + self._log.debug(u'[zero] {0}={1}' + .format(fn, getattr(item, fn))) @ZeroPlugin.listen('import_task_choice')