From 9d091c98f1f1bf7bacf49e9eaaa18ba8bb1bfd70 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 21 Dec 2008 19:34:32 -0700 Subject: Plugin.__init__() now checks that subclass hasn't defined attributes that conflict with the logger methods; added corresponding unit test --- ipalib/plugable.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ipalib/plugable.py') diff --git a/ipalib/plugable.py b/ipalib/plugable.py index f3b35d30..019386c3 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -263,8 +263,13 @@ class Plugin(ReadOnly): self.summary = '<%s>' % self.fullname else: self.summary = self.doc.split('\n\n', 1)[0] - log = logging.getLogger('ipa') - for name in ('debug', 'info', 'warning', 'error', 'critical'): + log = logging.getLogger(self.fullname) + for name in ('debug', 'info', 'warning', 'error', 'critical', 'exception'): + if hasattr(self, name): + raise StandardError( + '%s.%s attribute (%r) conflicts with Plugin logger' % ( + self.name, name, getattr(self, name)) + ) setattr(self, name, getattr(log, name)) def __get_api(self): -- cgit