Update Django and gvacommon dependencies

This commit updates the Django dependency version to 1.9.2 and gvacommon
to 0.3.0 that provides gvacommon.settings_utils.get_env_variable. The
gnuviechadmin.settings.base module now uses this implementation instead
of an own copy and the corresponding test has been removed too.
This commit is contained in:
Jan Dittberner 2016-02-01 22:27:05 +00:00
parent 6c606034b3
commit 3c5d02776a
3 changed files with 3 additions and 44 deletions

View file

@ -5,30 +5,12 @@ Common settings and globals.
""" """
from os import environ
from os.path import abspath, basename, dirname, join, normpath from os.path import abspath, basename, dirname, join, normpath
from sys import path 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 from django.contrib.messages import constants as messages
from gvacommon.settings_utils import get_env_variable
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)
# ######### PATH CONFIGURATION # ######### PATH CONFIGURATION

View file

@ -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')

View file

@ -1,4 +1,4 @@
Django==1.9.1 Django==1.9.2
curtsies==0.1.21 curtsies==0.1.21
bpython==0.14.2 bpython==0.14.2
django-braces==1.8.1 django-braces==1.8.1
@ -18,5 +18,5 @@ python-openid==2.2.5
requests==2.9.1 requests==2.9.1
requests-oauthlib==0.6.0 requests-oauthlib==0.6.0
simplejson==3.8.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 redis==2.10.5