From c4f56f9cb70815c57e4729eb36ce0138877efca1 Mon Sep 17 00:00:00 2001 From: Julen Ruiz Aizpuru Date: Tue, 15 Aug 2017 22:14:43 +0200 Subject: [PATCH] Settings: fix reference to environment variable The runner already expects the `ZING_SETTINGS` variable. --- docs/server/settings.rst | 6 +++--- pootle/settings/95-outro.conf | 12 ++++++------ tests/conftest.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/server/settings.rst b/docs/server/settings.rst index 3e69b4d7ac..02893edb18 100644 --- a/docs/server/settings.rst +++ b/docs/server/settings.rst @@ -3,7 +3,7 @@ Settings ======== -You will find all the Pootle-specific settings in this document. +You will find all the Zing-specific settings in this document. If you have upgraded, you might want to compare your previous copy to the one distributed with the Pootle version for any new settings you might be interested @@ -21,12 +21,12 @@ These settings will override the defaults set by Pootle. An alternative location for the settings file can be specified by setting the ``-c `` flag when executing the runner. You can also -set the :envvar:`POOTLE_SETTINGS` environment variable to specify the path to +set the :envvar:`ZING_SETTINGS` environment variable to specify the path to the custom configuration file. The environment variable will take precedence over the command-line flag. If instead of an installation you deployed Pootle straight from the git -repository, you can either set the :envvar:`POOTLE_SETTINGS` environment +repository, you can either set the :envvar:`ZING_SETTINGS` environment variable or put a file under the :file:`pootle/settings/` directory. Note that the files in this directory are read in alphabetical order, and **creating a 90-local.conf file is recommended** (files ending in *-local.conf* will be diff --git a/pootle/settings/95-outro.conf b/pootle/settings/95-outro.conf index 54c1416de0..e5c589ff77 100644 --- a/pootle/settings/95-outro.conf +++ b/pootle/settings/95-outro.conf @@ -6,10 +6,10 @@ import logging # Load custom settings if any have been defined -pootle_settings_envvar = 'POOTLE_SETTINGS' -pootle_settings_filepath = os.environ.get(pootle_settings_envvar, None) +zing_settings_envvar = 'ZING_SETTINGS' +zing_settings_filepath = os.environ.get(zing_settings_envvar, None) -if pootle_settings_filepath is not None: +if zing_settings_filepath is not None: logger = logging.getLogger('pootle.settings') # Set a handler to avoid the "No handlers could be found" error to happen. @@ -23,12 +23,12 @@ if pootle_settings_filepath is not None: try: logger.debug(u'Loading custom settings from %r...', - pootle_settings_filepath) - execfile(os.path.abspath(pootle_settings_filepath)) + zing_settings_filepath) + execfile(os.path.abspath(zing_settings_filepath)) except (IOError, OSError), e: logger.error(u"Cannot access configuration file at %r as defined by " u"the %r environment variable:\n%s", - pootle_settings_filepath, pootle_settings_envvar, e) + zing_settings_filepath, zing_settings_envvar, e) import sys sys.exit(1) diff --git a/tests/conftest.py b/tests/conftest.py index 16303e4ec9..e02532739a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -67,7 +67,7 @@ def pytest_configure(): from pootle import syspath_override # Needed for monkey-patching syspath_override os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings' - os.environ['POOTLE_SETTINGS'] = os.path.join(WORKING_DIR, 'settings.py') + os.environ['ZING_SETTINGS'] = os.path.join(WORKING_DIR, 'settings.py') # The call to `setup()` was needed before a fix for # pytest-dev/pytest-django#146 was available. This happened in version # 2.9; unfortunately upgrading to 2.9+ is not possible yet because a fix