Opened 13 years ago

Closed 12 years ago

#15741 closed New feature (fixed)

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

Reported by: Russell Keith-Magee 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 Russell Keith-Magee)

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.

Change History (8)

comment:1 by Russell Keith-Magee, 13 years ago

Description: modified (diff)

comment:2 by Russell Keith-Magee, 13 years ago

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 by Russell Keith-Magee, 13 years ago

Triage Stage: Design decision neededAccepted

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

comment:4 by Russell Keith-Magee, 13 years ago

In [15998]:

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

comment:5 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 by Aymeric Augustin, 12 years ago

Is this ticket still relevant?

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

comment:8 by Aymeric Augustin, 12 years ago

Resolution: fixed
Status: newclosed

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).

Note: See TracTickets for help on using tickets.
Back to Top