summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-05-20 13:21:59 -0500
committerDan McGee <dan@archlinux.org>2012-05-20 13:21:59 -0500
commitd685d51e8c80f29d4f14977a0d8088534e6626c4 (patch)
tree3f710fbf51e1a81e0a22c0da07480d09d68b3956 /main
parenteef1ee7051093b9f6e74ab5669af8c57983872d9 (diff)
downloadarchweb-d685d51e8c80f29d4f14977a0d8088534e6626c4.tar.gz
archweb-d685d51e8c80f29d4f14977a0d8088534e6626c4.zip
Ensure we use last_modified date from News in headers
We were actually using the postdate attribute rather than last_modified, which means any News objects that get edited would not trigger an update of the feed. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r--main/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/utils.py b/main/utils.py
index e7e47c53..b7cb19f4 100644
--- a/main/utils.py
+++ b/main/utils.py
@@ -72,7 +72,7 @@ def refresh_latest(**kwargs):
cache.set(cache_key, None, INVALIDATE_TIMEOUT)
-def retrieve_latest(sender):
+def retrieve_latest(sender, latest_by=None):
# we could break this down based on the request url, but it would probably
# cost us more in query time to do so.
cache_key = CACHE_LATEST_PREFIX + sender.__name__
@@ -80,8 +80,9 @@ def retrieve_latest(sender):
if latest:
return latest
try:
- latest_by = sender._meta.get_latest_by
- latest = sender.objects.values(latest_by).latest()[latest_by]
+ if latest_by is None:
+ latest_by = sender._meta.get_latest_by
+ latest = sender.objects.values(latest_by).latest(latest_by)[latest_by]
# Using add means "don't overwrite anything in there". What could be in
# there is an explicit None value that our refresh signal set, which
# means we want to avoid race condition possibilities for a bit.