MCPcopy
hub / github.com/django/django / find_location

Method find_location

django/contrib/staticfiles/finders.py:120–132  ·  view source on GitHub ↗

Find a requested static file in a location and return the found absolute path (or ``None`` if no match).

(self, root, path, prefix=None)

Source from the content-addressed store, hash-verified

118 return matches
119
120 def find_location(self, root, path, prefix=None):
121 """
122 Find a requested static file in a location and return the found
123 absolute path (or ``None`` if no match).
124 """
125 if prefix:
126 prefix = "%s%s" % (prefix, os.sep)
127 if not path.startswith(prefix):
128 return None
129 path = path.removeprefix(prefix)
130 path = safe_join(root, path)
131 if os.path.exists(path):
132 return path
133
134 def list(self, ignore_patterns):
135 """

Callers 1

findMethod · 0.95

Calls 2

safe_joinFunction · 0.90
existsMethod · 0.45

Tested by

no test coverage detected