Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #54 (closed defect: fixed)

Opened 14 years ago

Last modified 12 years ago

Use Accept header as an alternative to ?tg_format

Reported by: kevin Owned by: Jeff Watkins
Priority: normal Milestone: 0.9
Component: TurboGears Version:
Severity: normal Keywords:
Cc:

Description


Change History

comment:1 Changed 14 years ago by fumanchu@…

CherryPy? now has a helper function to access the contents of Accept* headers. See the "getAccept" function in  http://www.cherrypy.org/file/trunk/cherrypy/lib/httptools.py.

comment:2 Changed 13 years ago by Jeff Watkins

  • Owner changed from anonymous to Jeff Watkins
  • Milestone set to 0.9

This should be as simple as checking the Accept header for text/javascript. Since I was the one who wanted this feature, I think it's reasonable that I add it.

If the Accept header contains *ONLY* text/javascript, TG will set the format to JSON. Anything else in the Accept header and you have to specify ?tg_format=JSON.

comment:3 Changed 13 years ago by Jeff Watkins

Fixed in r377. Accept header must contain ONLY test/javascript to trigger format. (Also includes a test in test_controllers.py.)

comment:4 Changed 13 years ago by Jeff Watkins

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.