Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #357 (defect)

Opened 3 years ago

Last modified 3 years ago

Provide pythonic access to Accept-* request headers

Status: closed (fixed)

Reported by: fumanchu Assigned to: fumanchu
Priority: normal Milestone: 2.2-beta
Component: CherryPy code Keywords: Accept header
Cc:

See the discussion here: http://groups.google.com/group/cherrypy-users/browse_frm/thread/24c1d36263d76e07

CherryPy should at least provide a function in lib/cptools.py which returns the values of an Accept request header in a dict. The other headers, such as Accept-Encoding, Accept-Language, etc would need further discussion, although a filter is probably the answer to all of them.

Change History

10/21/05 12:57:31: Modified by fumanchu

  • status changed from new to assigned.

11/01/05 01:32:19: Modified by fumanchu

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed in [774]. New cptools.getAccept(headername) function, which returns a list of AcceptValue? objects, sorted in descending priority order. Each AcceptValue? object has a qvalue attribute (the priority from 0.0 to 1.0). Each AcceptValue? object also possesses a "params" attribute, a dict; it will only be populated if 'headername' is 'Accept' (in which case the "q" param may itself be an AcceptValue? with params). The other Accept-* headers don't allow params other than the initial "q" param (the qvalue).

Hosted by WebFaction

Log in as guest/cpguest to create tickets