BaseFinder is a class within the django.contrib.staticfiles.finders module of the Django project.
django-pipeline (project documentation and PyPI package information) is a code library for handling and compressing static content assets when handling requests in Django web applications.
The django-pipeline project is open sourced under the MIT License and it is maintained by the developer community group Jazzband.
django-pipeline / pipeline / finders.py
# finders.py
from itertools import chain
from django.contrib.staticfiles.storage import staticfiles_storage
from django.contrib.staticfiles.finders import BaseFinder, BaseStorageFinder, find, \
AppDirectoriesFinder as DjangoAppDirectoriesFinder, FileSystemFinder as DjangoFileSystemFinder
from django.utils._os import safe_join
from os.path import normpath
from pipeline.conf import settings
class PipelineFinder(BaseStorageFinder):
storage = staticfiles_storage
def find(self, path, all=False):
if not settings.PIPELINE_ENABLED:
return super(PipelineFinder, self).find(path, all)
else:
return []
def list(self, ignore_patterns):
return []
class ManifestFinder(BaseFinder):
def find(self, path, all=False):
matches = []
for elem in chain(settings.STYLESHEETS.values(), settings.JAVASCRIPT.values()):
if normpath(elem['output_filename']) == normpath(path):
match = safe_join(settings.PIPELINE_ROOT, path)
if not all:
return match
matches.append(match)
return matches
def list(self, *args):
return []
class CachedFileFinder(BaseFinder):
def find(self, path, all=False):
try:
start, _, extn = path.rsplit('.', 2)
except ValueError:
return []
path = '.'.join((start, extn))
return find(path, all=all) or []
def list(self, *args):
return []
class PatternFilterMixin(object):
ignore_patterns = []
def get_ignored_patterns(self):
return list(set(self.ignore_patterns))
def list(self, ignore_patterns):
if ignore_patterns:
ignore_patterns = ignore_patterns + self.get_ignored_patterns()
return super(PatternFilterMixin, self).list(ignore_patterns)
## ... source file continues with no further BaseFinder examples...