patch_cache_control should replace public/private setting if already set
|Reported by:||Andreas Sommer||Owned by:||Andreas Sommer|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In the following scenario
@_cache_control_iff_user_is_anonymous(public = True, must_revalidate = False, max_age = 60) @cache_control(private = True, must_revalidate = True, max_age = 1200) @vary_on_cookie def myView(request): ...
I am applying the private caching attribute by default, and want to replace "private" with "public" iff the user is not logged in (for more aggressive caching).
But what I get with the above code is "Cache-Control: public, private, must-revalidate=False, max-age=60". So instead of just adding the "public" attribute, one should as well remove the "private" attribute.
See attached diff for a simple solution.
Change History (15)
comment:1 Changed 6 years ago by
|Component:||Cache system → HTTP handling|
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|
comment:2 Changed 6 years ago by
|Owner:||changed from nobody to Andreas Sommer|
|Status:||new → assigned|
comment:4 Changed 6 years ago by
|Patch needs improvement:||unset|