Code

Ticket #5047: max_age.diff

File max_age.diff, 524 bytes (added by permon, 7 years ago)

update

Line 
1Index: django/utils/cache.py
2===================================================================
3--- django/utils/cache.py       (revision 6397)
4+++ django/utils/cache.py       (working copy)
5@@ -57,6 +57,10 @@
6         cc = dict([dictitem(el) for el in cc])
7     else:
8         cc = {}
9+
10+    if 'max-age' in cc and 'max_age' in kwargs:
11+        kwargs['max_age'] = min(cc['max-age'], kwargs['max_age'])
12+
13     for (k,v) in kwargs.items():
14         cc[k.replace('_', '-')] = v
15     cc = ', '.join([dictvalue(el) for el in cc.items()])