From 2d10367098b1e7424a48de670c6a936f2b4dbb0f Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 16 Sep 2015 19:06:59 +0200 Subject: Reporting: Clear error message if django is missing --- src/lib/Bcfg2/Server/Plugins/Reporting.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py index b9dcdcc81..e372006c7 100644 --- a/src/lib/Bcfg2/Server/Plugins/Reporting.py +++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py @@ -8,17 +8,16 @@ import Bcfg2.Options from Bcfg2.Reporting.Transport.base import TransportError from Bcfg2.Server.Plugin import Statistics, PullSource, Threaded, \ PluginInitError, PluginExecutionError -import django -# required for reporting -if django.VERSION[0] == 1 and django.VERSION[1] >= 7: - HAS_REPORTING = True -else: - try: +try: + import django + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + HAS_REPORTING = True + else: import south # pylint: disable=W0611 HAS_REPORTING = True - except ImportError: - HAS_REPORTING = False +except ImportError: + HAS_REPORTING = False def _rpc_call(method): -- cgit v1.2.3-1-g7c22