From a06fe3ad5f52a3254df9fccb1683318447439c9c Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 17 Nov 2013 16:40:15 +0400 Subject: [PATCH] Do not double pl.exception() call, record used pl in variable instead --- powerline/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/powerline/__init__.py b/powerline/__init__.py index 53ffd932..629c5302 100644 --- a/powerline/__init__.py +++ b/powerline/__init__.py @@ -488,8 +488,5 @@ class Powerline(object): def exception(self, msg, *args, **kwargs): if 'prefix' not in kwargs: kwargs['prefix'] = 'powerline' - try: - return self.pl.exception(msg, *args, **kwargs) - except AttributeError: - pl = _get_fallback_logger() - return pl.exception(msg, *args, **kwargs) + pl = getattr(self, 'pl', None) or _get_fallback_logger() + return pl.exception(msg, *args, **kwargs)