MIMEAccept

Represents the Accept header, which is a list of mimetypes.

This class knows about mime wildcards, like image/*


Methods

f __init__(self, header_name, header_value) ...

f __add__(self, other, reversed=False) ...

f __radd__(self, other) ...

f __contains__(self, match) ...

Returns true if the given object is listed in the accepted types.

f quality(self, match) ...

Return the quality of the given match. Returns None if there is no match (not 0).

f first_match(self, matches) ...

Returns the first match in the sequences of matches that is allowed. Ignores quality. Returns the first item if nothing else matches; or if you include None at the end of the match list then that will be returned.

f best_match(self, matches, default_match=None) ...

Returns the best match in the sequence of matches.

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.

default_match (default None) is returned if there is no intersection.

f best_matches(self, fallback=None) ...

Return all the matches in order of quality, with fallback (if given) at the end.

f accept_html(self) ...

Returns true if any HTML-like type is accepted

See the source for more information.