Use import instead of sys.modules for verifying ara-server availability
If ara.server hasn't been imported already, it won't be there. Change-Id: I6d9c79142b33882cf634db1c439c1df6f2c96c5c
This commit is contained in:
parent
f5edb8d609
commit
4a3f2b4418
@ -33,8 +33,11 @@ class AraOfflineClient(AraHttpClient):
|
||||
def __init__(self):
|
||||
self.log = logging.getLogger(__name__)
|
||||
|
||||
# Validate that ara-server is installed
|
||||
if "ara.server" not in sys.modules:
|
||||
# Validate that ara-server is available before letting Django attempt to
|
||||
# import it
|
||||
try:
|
||||
import ara.server
|
||||
except ImportError:
|
||||
raise ImportError("AraOfflineClient requires ara-server to be installed.")
|
||||
|
||||
from django import setup as django_setup
|
||||
|
Loading…
x
Reference in New Issue
Block a user