diff --git a/beets/plugins.py b/beets/plugins.py index 44e94e7df..b3109a690 100755 --- a/beets/plugins.py +++ b/beets/plugins.py @@ -44,8 +44,10 @@ class BeetsPlugin(object): self.import_stages = [] self.name = name or self.__module__.split('.')[-1] self.config = beets.config[self.name] - self.template_funcs = {} - self.template_fields = {} + if not self.template_funcs: + self.template_funcs = {} + if not self.template_fields: + self.template_fields = {} def commands(self): """Should return a list of beets.ui.Subcommand objects for diff --git a/beetsplug/inline.py b/beetsplug/inline.py index 1fb492087..81a003cb7 100644 --- a/beetsplug/inline.py +++ b/beetsplug/inline.py @@ -89,8 +89,6 @@ def compile_inline(python_code): return _func_func class InlinePlugin(BeetsPlugin): - template_fields = {} - def __init__(self): super(InlinePlugin, self).__init__() @@ -103,4 +101,4 @@ class InlinePlugin(BeetsPlugin): log.debug(u'adding template field %s' % key) func = compile_inline(view.get(unicode)) if func is not None: - InlinePlugin.template_fields[key] = func + self.template_fields[key] = func diff --git a/beetsplug/rewrite.py b/beetsplug/rewrite.py index e5ddc0a2b..a02538902 100644 --- a/beetsplug/rewrite.py +++ b/beetsplug/rewrite.py @@ -44,7 +44,6 @@ def rewriter(field, rules): class RewritePlugin(BeetsPlugin): def __init__(self): super(RewritePlugin, self).__init__() - BeetsPlugin.template_fields = {} self.config.add({}) @@ -68,5 +67,4 @@ class RewritePlugin(BeetsPlugin): # Replace each template field with the new rewriter function. for fieldname, fieldrules in rules.iteritems(): - RewritePlugin.template_fields[fieldname] = \ - rewriter(fieldname, fieldrules) + self.template_fields[fieldname] = rewriter(fieldname, fieldrules)