Ticket #15499: allow-cache-control-private-override.diff

File allow-cache-control-private-override.diff, 661 bytes (added by AndiDog, 4 years ago)

Simple patch

  • django/utils/cache.py

     
    6767    if 'max-age' in cc and 'max_age' in kwargs:
    6868        kwargs['max_age'] = min(cc['max-age'], kwargs['max_age'])
    6969
     70    # Allow overriding private caching and vice versa
     71    if 'private' in cc and 'public' in kwargs:
     72        del cc['private']
     73    elif 'public' in cc and 'private' in kwargs:
     74        del cc['public']
     75
    7076    for (k, v) in kwargs.items():
    7177        cc[k.replace('_', '-')] = v
    7278    cc = ', '.join([dictvalue(el) for el in cc.items()])
Back to Top