diff --git a/gvaldap/gvaldap/settings/base.py b/gvaldap/gvaldap/settings/base.py index a837266..a0b950b 100644 --- a/gvaldap/gvaldap/settings/base.py +++ b/gvaldap/gvaldap/settings/base.py @@ -5,29 +5,10 @@ Common settings and globals. """ -from os import environ from os.path import abspath, basename, dirname, join, normpath from sys import path -# Normally you should not import ANYTHING from Django directly -# into your settings, but ImproperlyConfigured is an exception. -from django.core.exceptions import ImproperlyConfigured - - -def get_env_variable(var_name): - """ - Get a setting from an environment variable. - - :param str var_name: variable name - :raises ImproperlyConfigured: if the environment setting is not defined - :return: environment setting value - :rtype: str - """ - try: - return environ[var_name] - except KeyError: - error_msg = "Set the %s environment variable" % var_name - raise ImproperlyConfigured(error_msg) +from gvacommon.settings_utils import get_env_variable # ######### PATH CONFIGURATION diff --git a/gvaldap/gvaldap/tests/test_settings.py b/gvaldap/gvaldap/tests/test_settings.py deleted file mode 100644 index 8fed62f..0000000 --- a/gvaldap/gvaldap/tests/test_settings.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -This module implements tests for :py:mod:`gvaldap.settings`. - -""" -from __future__ import absolute_import - -import os -from unittest import TestCase - -from django.core.exceptions import ImproperlyConfigured - -from gvaldap.settings.base import get_env_variable - - -class GetEnvVariableTest(TestCase): - - def test_get_existing_env_variable(self): - os.environ['testvariable'] = 'myvalue' - self.assertEqual(get_env_variable('testvariable'), 'myvalue') - - def test_get_missing_env_variable(self): - if 'missingvariable' in os.environ: - del os.environ['missingvariable'] - with self.assertRaises(ImproperlyConfigured) as e: - get_env_variable('missingvariable') - self.assertEqual( - str(e.exception), 'Set the missingvariable environment variable') diff --git a/requirements/base.txt b/requirements/base.txt index 72a3736..19c87b4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -Django==1.9.1 +Django==1.9.2 Jinja2==2.8 #django-ldapdb==0.4.0 -e git+https://github.com/jandd/django-ldapdb@django19#egg=django-ldapdb @@ -16,5 +16,5 @@ pytz==2015.7 passlib==1.6.5 requests==2.9.1 simplejson==3.8.1 --e git+https://git.gnuviech-server.de/gvacommon.git@0.2.1#egg=gvacommon +-e git+https://git.gnuviech-server.de/gvacommon.git@0.3.0#egg=gvacommon redis==2.10.5