MCPcopy
hub / github.com/django/django / stored_name

Method stored_name

django/contrib/staticfiles/storage.py:564–581  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

562 self.manifest_storage._save(self.manifest_name, ContentFile(contents))
563
564 def stored_name(self, name):
565 parsed_name = urlsplit(unquote(name))
566 clean_name = parsed_name.path.strip()
567 hash_key = self.hash_key(clean_name)
568 cache_name = self.hashed_files.get(hash_key)
569 if cache_name is None:
570 if self.manifest_strict:
571 raise ValueError(
572 "Missing staticfiles manifest entry for '%s'" % clean_name
573 )
574 cache_name = self.clean_name(self.hashed_name(name))
575 unparsed_name = list(parsed_name)
576 unparsed_name[2] = cache_name
577 # Special casing for a @font-face hack, like url(myfont.eot?#iefix")
578 # http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax
579 if "?#" in name and not unparsed_name[3]:
580 unparsed_name[2] += "?"
581 return urlunsplit(unparsed_name)
582
583
584class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage):

Callers

nothing calls this directly

Calls 5

unquoteFunction · 0.85
hash_keyMethod · 0.80
clean_nameMethod · 0.80
hashed_nameMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected