Do not rely on django yet.

This commit is contained in:
Antoine Nguyen
2015-04-22 16:52:12 +02:00
parent 063756461b
commit d387f33898
2 changed files with 9 additions and 7 deletions
+4 -1
View File
@@ -151,7 +151,10 @@ class DeployCommand(Command):
"""
if "all" in extensions:
official_exts = ModoAPIClient().list_extensions()
# We hardcode the API url here to avoid a loading of
# django's settings since they are not available yet...
url = "http://api.modoboa.org/"
official_exts = ModoAPIClient(url).list_extensions()
extensions = [extension["name"] for extension in official_exts]
pip_args = ["install"] + extensions
+5 -6
View File
@@ -6,8 +6,6 @@ import pkg_resources
import requests
from requests.exceptions import RequestException
from django.conf import settings
from versionfield.constants import DEFAULT_NUMBER_BITS
from versionfield.version import Version
@@ -18,10 +16,11 @@ class ModoAPIClient(object):
def __init__(self, api_url=None):
"""Constructor."""
self._api_url = (
settings.MODOBOA_API_URL if api_url is None
else api_url
)
if api_url is None:
from django.conf import settings
self._api_url = settings.MODOBOA_API_URL
else:
self._api_url = api_url
self._local_core_version = None
self._latest_core_version = None
self.changelog_url = None