Skip to content

Commit 8f6e518

Browse files
committed
Fixed some additional places to use the new settings.TEMPLATES structure.
- Legacy-Id: 12459
1 parent 3864911 commit 8f6e518

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

ietf/settings_testcrawl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from settings import * # pyflakes:ignore
99

10-
TEMPLATE_LOADERS = (
10+
TEMPLAT[0]['OPTIONS']['loaders'] = (
1111
('django.template.loaders.cached.Loader', (
1212
'django.template.loaders.filesystem.Loader',
1313
'django.template.loaders.app_directories.Loader',

ietf/utils/test_runner.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class TemplateCoverageLoader(BaseLoader):
112112
is_usable = True
113113

114114
def load_template_source(self, template_name, dirs):
115+
global template_coverage_collection, loaded_templates
115116
if template_coverage_collection == True:
116117
loaded_templates.add(str(template_name))
117118
raise TemplateDoesNotExist
@@ -159,7 +160,7 @@ def get_template_paths(apps=None):
159160
# TODO: Add app templates to the full list, if we are using
160161
# django.template.loaders.app_directories.Loader
161162
templates = set()
162-
templatepaths = settings.TEMPLATE_DIRS
163+
templatepaths = settings.TEMPLATES[0]['DIRS']
163164
for templatepath in templatepaths:
164165
for dirpath, dirs, files in os.walk(templatepath):
165166
if ".svn" in dirs:
@@ -395,7 +396,7 @@ def setup_test_environment(self, **kwargs):
395396
},
396397
}
397398

398-
settings.TEMPLATE_LOADERS = ('ietf.utils.test_runner.TemplateCoverageLoader',) + settings.TEMPLATE_LOADERS
399+
settings.TEMPLATES[0]['OPTIONS']['loaders'] = ('ietf.utils.test_runner.TemplateCoverageLoader',) + settings.TEMPLATES[0]['OPTIONS']['loaders']
399400
template_coverage_collection = True
400401

401402
settings.MIDDLEWARE_CLASSES = ('ietf.utils.test_runner.RecordUrlsMiddleware',) + settings.MIDDLEWARE_CLASSES
@@ -412,9 +413,9 @@ def setup_test_environment(self, **kwargs):
412413
print " Changing SITE_ID to '1' during testing."
413414
settings.SITE_ID = 1
414415

415-
if settings.TEMPLATE_STRING_IF_INVALID != '':
416-
print " Changing TEMPLATE_STRING_IF_INVALID to '' during testing."
417-
settings.TEMPLATE_STRING_IF_INVALID = ''
416+
if settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] != '':
417+
print(" Changing settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] to '' during testing")
418+
settings.TEMPLATES[0]['OPTIONS']['string_if_invalid'] = ''
418419

419420
assert not settings.IDTRACKER_BASE_URL.endswith('/')
420421

0 commit comments

Comments
 (0)