Django

Code

Changeset 6434

Show
Ignore:
Timestamp:
09/28/07 17:30:59 (1 year ago)
Author:
jacob
Message:

Fixed #5047: patch_cache_control now respects existing max-age settings. Thanks, permon.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r6408 r6434  
    235235    pavithran s <pavithran.s@gmail.com> 
    236236    Barry Pederson <bp@barryp.org> 
     237    permonik@mesias.brnonet.cz 
    237238    petr.marhoun@gmail.com 
    238239    pgross@thoughtworks.com 
  • django/trunk/django/utils/cache.py

    r6222 r6434  
    5858    else: 
    5959        cc = {} 
     60 
     61    # If there's already a max-age header but we're being asked to set a new 
     62    # max-age, use the minumum of the two ages. In practice this happens when 
     63    # a decorator and a piece of middleware both operate on a given view. 
     64    if 'max-age' in cc and 'max_age' in kwargs: 
     65        kwargs['max_age'] = min(cc['max-age'], kwargs['max_age']) 
     66 
    6067    for (k,v) in kwargs.items(): 
    6168        cc[k.replace('_', '-')] = v