Author: jacob
Date: 2007-09-28 17:30:59 -0500 (Fri, 28 Sep 2007)
New Revision: 6434
Modified:
django/trunk/AUTHORS
django/trunk/django/utils/cache.py
Log:
Fixed #5047: patch_cache_control now respects existing max-age settings.
Thanks, permon.
Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS 2007-09-28 19:35:50 UTC (rev 6433)
+++ django/trunk/AUTHORS 2007-09-28 22:30:59 UTC (rev 6434)
@@ -234,6 +234,7 @@
Jay Parlar <[EMAIL PROTECTED]>
pavithran s <[EMAIL PROTECTED]>
Barry Pederson <[EMAIL PROTECTED]>
+ [EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
phaedo <http://phaedo.cx/>
Modified: django/trunk/django/utils/cache.py
===================================================================
--- django/trunk/django/utils/cache.py 2007-09-28 19:35:50 UTC (rev 6433)
+++ django/trunk/django/utils/cache.py 2007-09-28 22:30:59 UTC (rev 6434)
@@ -57,6 +57,13 @@
cc = dict([dictitem(el) for el in cc])
else:
cc = {}
+
+ # If there's already a max-age header but we're being asked to set a new
+ # max-age, use the minumum of the two ages. In practice this happens when
+ # a decorator and a piece of middleware both operate on a given view.
+ if 'max-age' in cc and 'max_age' in kwargs:
+ kwargs['max_age'] = min(cc['max-age'], kwargs['max_age'])
+
for (k,v) in kwargs.items():
cc[k.replace('_', '-')] = v
cc = ', '.join([dictvalue(el) for el in cc.items()])
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---