summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-11-02 17:45:32 +0000
committerJannis Leidel <jannis@leidel.info>2011-11-02 17:45:32 +0000
commit0e2c543979dfd06a40c1b34a6fb8eda2e92c8771 (patch)
treee76901f1a4831c52f845e72b8b66ec5304727f65 /django
parent44a4037466f3f2db02ce191f05faa3230c17e910 (diff)
Fixed #16967 -- Made sure CachedStaticFilesStorage repopulates its cache if there was a miss (for example if the cache server went down).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17067 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/storage.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index cf0c4a0e3a..ecb6769973 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -90,11 +90,14 @@ class CachedFilesMixin(object):
Returns the real URL in DEBUG mode.
"""
if settings.DEBUG and not force:
- return super(CachedFilesMixin, self).url(name)
- cache_key = self.cache_key(name)
- hashed_name = self.cache.get(cache_key)
- if hashed_name is None:
- hashed_name = self.hashed_name(name)
+ hashed_name = name
+ else:
+ cache_key = self.cache_key(name)
+ hashed_name = self.cache.get(cache_key)
+ if hashed_name is None:
+ hashed_name = self.hashed_name(name)
+ # set the cache if there was a miss (e.g. if cache server goes down)
+ self.cache.set(cache_key, hashed_name)
return super(CachedFilesMixin, self).url(hashed_name)
def url_converter(self, name):