MCPcopy
hub / github.com/django/django / find

Function find

django/contrib/staticfiles/finders.py:277–296  ·  view source on GitHub ↗

Find a static file with the given path using all enabled finders. If ``find_all`` is ``False`` (default), return the first matching absolute path (or ``None`` if no match). Otherwise return a list.

(path, find_all=False)

Source from the content-addressed store, hash-verified

275
276
277def find(path, find_all=False):
278 """
279 Find a static file with the given path using all enabled finders.
280
281 If ``find_all`` is ``False`` (default), return the first matching
282 absolute path (or ``None`` if no match). Otherwise return a list.
283 """
284 searched_locations[:] = []
285 matches = []
286 for finder in get_finders():
287 result = finder.find(path, find_all=find_all)
288 if not find_all and result:
289 return result
290 if not isinstance(result, (list, tuple)):
291 result = [result]
292 matches.extend(result)
293 if matches:
294 return matches
295 # No match.
296 return [] if find_all else None
297
298
299def get_finders():

Callers

nothing calls this directly

Calls 3

get_findersFunction · 0.85
extendMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected