Code

Opened 4 years ago

Closed 4 years ago

#14723 closed (duplicate)

@last_modified should ignore lack of etag method when USE_ETAGS is enabled

Reported by: lamby Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using @last_modified with settings.USE_ETAGS does not work as expected.

My goal is to avoid evaluating the view for a select handful of expensive pages based on the Last-Modified header, and globally fallback to saving bandwidth with USE_ETAGS.

However, if you enable USE_ETAGS and the @last_modified decorator, the view is still evaluated despite the last_modified_func being a match with If-Modified-Since. This is because the client is providing an ETag header (added because USE_ETAGS is enabled) and django.views.decorators.http.condition uses that etag along with the fact that we did did not provide an etag_func argument as a reason for not returning 304.

Patch attached that disables this particular part of the logic if settings.USE_ETAGS is enabled.

Attachments (1)

patch.txt (1.1 KB) - added by lamby 4 years ago.

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by lamby

comment:1 Changed 4 years ago by lamby

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

duplicate, sorry.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.