Code

Opened 3 years ago

Closed 2 years ago

#15741 closed New feature (fixed)

Class-based generic views dropped support for X-Object-* headers

Reported by: russellm Owned by: nobody
Component: Generic views Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by russellm)

The function-based generic views use the django.core.xheaders.populate_xheaders method to attach a X-Object-Type and X-Object-Id header to responses served by a generic view. This debug information in the response

Django needs to either:

  1. Deprecate and remove populate_xheaders, or
  2. Add X-Object-Type and X-Object-Id header support to class-based generic views.

If we choose to do (2), then we can't just wrap the generic view response in populate_xheaders, because we don't have access to the response object at the time at which we determine the object that is in use. It will probably be necessary to add generic support to define headers anywhere in the lifespan of a request, and then apply those headers when the response is constructed; i.e., in much the same way that self.request is available throughout the lifespan of a request, make self.response_headers available throughout the lifespan of a request.

Attachments (0)

Change History (8)

comment:1 Changed 3 years ago by russellm

  • Description modified (diff)

comment:2 Changed 3 years ago by russellm

This came to my attention in the process of deprecating function-based generic views; the regressiontests.special_headers regression test contains specific tests for the X-Object-Type headers, and the test wasn't directly convertible to generic views.

comment:3 Changed 3 years ago by russellm

  • Triage Stage changed from Design decision needed to Accepted

After a brief discussion with Jannis on IRC, option (2) seems like the best approach.

comment:4 Changed 3 years ago by russellm

In [15998]:

Silenced DeprecationWarning raised by tests for populate_xheaders tests. Refs #15741

comment:5 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:7 Changed 2 years ago by aaugustin

Is this ticket still relevant?

AFAICT, we removed the function-based generic views without providing a replacement for this feature.

comment:8 Changed 2 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

Since we did remove the feature (option 1), I'm going to mark this fixed... Please reopen if you want this feature added to the class based generic views (I don't know the use case).

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.