Opened 14 years ago
Closed 13 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 )
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:
- Deprecate and remove populate_xheaders, or
- 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 , 14 years ago
Description: | modified (diff) |
---|
comment:2 by , 14 years ago
comment:3 by , 14 years ago
Triage Stage: | Design decision needed → Accepted |
---|
After a brief discussion with Jannis on IRC, option (2) seems like the best approach.
comment:7 by , 13 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 , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → 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).
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.