diff --git a/gnuviechadmin/gnuviechadmin/settings/base.py b/gnuviechadmin/gnuviechadmin/settings/base.py index 15b4128..d1ce425 100644 --- a/gnuviechadmin/gnuviechadmin/settings/base.py +++ b/gnuviechadmin/gnuviechadmin/settings/base.py @@ -5,30 +5,12 @@ 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 from django.contrib.messages import constants as messages - -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/gnuviechadmin/gnuviechadmin/tests/test_settings.py b/gnuviechadmin/gnuviechadmin/tests/test_settings.py deleted file mode 100644 index ed69779..0000000 --- a/gnuviechadmin/gnuviechadmin/tests/test_settings.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- python -*- -# -*- coding: utf-8 -*- -import os -from unittest import TestCase - -from django.core.exceptions import ImproperlyConfigured - -from gnuviechadmin.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 d08a5dc..ab8fc2c 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -Django==1.9.1 +Django==1.9.2 curtsies==0.1.21 bpython==0.14.2 django-braces==1.8.1 @@ -18,5 +18,5 @@ python-openid==2.2.5 requests==2.9.1 requests-oauthlib==0.6.0 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