Ticket #1473 (closed defect: fixed)
Implement Changes to Content Negotiation system
| Reported by: | mramm | Owned by: | percious |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.0b3 |
| Component: | TurboGears | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by mramm) (diff)
We need to modify the expose decorator in pylons to set overide the accept headers if there is a file extension. So calling /index.html means you want html back while index.xhtml means you want xhtml, and .rss means you want xml/rss .json means you want JSON etc.
The way it works now is that accept headers are overridden by tg_format and this should still work, but be depricated in favor of file extensions.
This makes for much nicer URL's and allows you to request specific return types even on http get requests.
Change History
comment:4 Changed 4 years ago by mramm
Pylons just grew some helpful new mimetype features:
http://pylonshq.com/project/pylonshq/changeset/1293%3A28eed5438061
comment:5 Changed 4 years ago by khorn
Dont' forget the standard library mimetypes module...
An example of how this can be used is here: http://pythonpaste.org/webob/file-example.html
we might be able to do something similar, at least as a stopgap until we have time/resources to do something else
comment:6 Changed 4 years ago by khorn
I expect #1691 will need to be fixed before much progress can be made here, since in some cases the content-type header is being set twice
comment:10 Changed 4 years ago by mramm
I expect we will want to work on this ticket at the PyCon2008 sprint
comment:12 Changed 3 years ago by jorge.vargas
- Milestone changed from 2.0 to 2.0b1
This is a very nice feature I'll like to see sooner than later.
comment:15 Changed 3 years ago by percious
- Status changed from new to closed
- Resolution set to fixed