From 8f6e51839f7fa2e7780c6e2724992fa07cc24bab Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz <henrik@levkowetz.com> Date: Mon, 5 Dec 2016 19:04:27 +0000 Subject: [PATCH] Fixed some additional places to use the new settings.TEMPLATES structure. - Legacy-Id: 12459 --- ietf/settings_testcrawl.py | 2 +- ietf/utils/test_runner.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ietf/settings_testcrawl.py b/ietf/settings_testcrawl.py index 6204fde91..506ceeab0 100644 --- a/ietf/settings_testcrawl.py +++ b/ietf/settings_testcrawl.py @@ -7,7 +7,7 @@ from settings import * # pyflakes:ignore -TEMPLATE_LOADERS = ( +TEMPLAT[0]['OPTIONS']['loaders'] = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', diff --git a/ietf/utils/test_runner.py b/ietf/utils/test_runner.py index 272d0c9bc..d1c2b84d4 100644 --- a/ietf/utils/test_runner.py +++ b/ietf/utils/test_runner.py @@ -112,6 +112,7 @@ class TemplateCoverageLoader(BaseLoader): is_usable = True def load_template_source(self, template_name, dirs): + global template_coverage_collection, loaded_templates if template_coverage_collection == True: loaded_templates.add(str(template_name)) raise TemplateDoesNotExist @@ -159,7 +160,7 @@ def get_template_paths(apps=None): # TODO: Add app templates to the full list, if we are using # django.template.loaders.app_directories.Loader templates = set() - templatepaths = settings.TEMPLATE_DIRS + templatepaths = settings.TEMPLATES[0]['DIRS'] for templatepath in templatepaths: for dirpath, dirs, files in os.walk(templatepath): if ".svn" in dirs: @@ -395,7 +396,7 @@ class IetfTestRunner(DiscoverRunner): }, } - settings.TEMPLATE_LOADERS = ('ietf.utils.test_runner.TemplateCoverageLoader',) + settings.TEMPLATE_LOADERS + settings.TEMPLATES[0]['OPTIONS']['loaders'] = ('ietf.utils.test_runner.TemplateCoverageLoader',) + settings.TEMPLATES[0]['OPTIONS']['loaders'] template_coverage_collection = True settings.MIDDLEWARE_CLASSES = ('ietf.utils.test_runner.RecordUrlsMiddleware',) + settings.MIDDLEWARE_CLASSES @@ -412,9 +413,9 @@ class IetfTestRunner(DiscoverRunner): print " Changing SITE_ID to '1' during testing." settings.SITE_ID = 1 - if settings.TEMPLATE_STRING_IF_INVALID != '': - print " Changing TEMPLATE_STRING_IF_INVALID to '' during testing." - settings.TEMPLATE_STRING_IF_INVALID = '' + if settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] != '': + print(" Changing settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] to '' during testing") + settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] = '' assert not settings.IDTRACKER_BASE_URL.endswith('/')