Skip to content

Commit b78fb9a

Browse files
committed
Merge pull request django-compressor#498 from mikebryant/wip-493
Relax the test for a configured CachedLoader. Fixes django-compressor#493.
2 parents cc5257f + 1838e05 commit b78fb9a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

compressor/management/commands/compress.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
from django.utils.importlib import import_module
1414
from django.template.loader import get_template # noqa Leave this in to preload template locations
1515

16-
try:
17-
from django.template.loaders.cached import Loader as CachedLoader
18-
except ImportError:
19-
CachedLoader = None # noqa
20-
2116
from compressor.cache import get_offline_hexdigest, write_offline_manifest
2217
from compressor.conf import settings
2318
from compressor.exceptions import (OfflineGenerationError, TemplateSyntaxError,
@@ -87,8 +82,10 @@ def get_loaders(self):
8782
# )
8883
# The loaders will return django.template.loaders.filesystem.Loader
8984
# and django.template.loaders.app_directories.Loader
85+
# The cached Loader and similar ones include a 'loaders' attribute
86+
# so we look for that.
9087
for loader in template_source_loaders:
91-
if CachedLoader is not None and isinstance(loader, CachedLoader):
88+
if hasattr(loader, 'loaders'):
9289
loaders.extend(loader.loaders)
9390
else:
9491
loaders.append(loader)

0 commit comments

Comments
 (0)