webob -- Request/Response objects¶
Parses a variety of
These headers generally take the form of:
value1; q=0.5, value2; q=0
q parameter is optional. In theory other parameters
exists, but this ignores them.
Represents a generic
This object should not be modified. To add items you can use
accept_obj + 'accept_thing'to get a new object
Returns the best match in the sequence of offered types.
The sequence can be a simple sequence, or you can have
(match, server_quality)items in the sequence. If you have these tuples then the client quality is multiplied by the server_quality to get a total. If two matches have equal weight, then the one that shows up first in the offers list will be returned.
But among matches with the same quality the match to a more specific requested type will be chosen. For example a match to text/* trumps /.
default_match (default None) is returned if there is no intersection.
Return iterator of
qualitydefaults to 1.
Return the quality of the given offer. Returns None if there is no match (not 0).
Represents the Cache-Control header.
By giving a type of
'response'you can control what attributes are allowed (some Cache-Control values only apply to requests or responses).
Returns a copy of this object.
parse(header, updates_to=None, type=None)¶
Parse the header, returning a CacheControl object.
The object is bound to the request or response object
updates_to, if that is given.
Misc Functions and Internals¶
HTML-escape a string or object
This converts any non-string objects passed into it to strings (actually, using
unicode()). All values returned are non-unicode strings (using
&#num;entities for all non-ASCII characters).
None is treated specially, and returns the empty string.
Dictionary view on the response headerlist. Keys are normalized for case and whitespace.
An object that represents the headers as present in a WSGI environment.
This object is a wrapper (with no internal state) for a WSGI request object, representing the CGI-style HTTP_* keys as a dictionary. Because a CGI environment can only hold one value for each key, this dictionary is single-valued (unlike outgoing headers).
Dict that has a callback on all updates