Ņō
đ\"Lc @ sa d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d
Z
d Z d S(
s MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of
the HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
Contents:
- parse_mime_type(): Parses a mime-type into its component parts.
- parse_media_range(): Media-ranges are mime-types with wild-cards and a 'q' quality parameter.
- quality(): Determines the quality ('q') of a mime-type when compared against a list of media-ranges.
- quality_parsed(): Just like quality() except the second parameter must be pre-parsed.
- best_match(): Choose the mime-type with the highest quality ('q') from a list of candidates.
s 0.1.2s Joe Gregorios joe@bitworking.orgt c
C sŋ | i d } t g } | d D]= } | t g } | i d D] } | | i qA ~ q! ~ } | d i } | d j o
d } n | i d \ } } | i | i | f S( s3 Carves up a mime-type and returns a tuple of the
(type, subtype, params) where 'params' is a dictionary
of all the parameters for the media range.
For example, the media range 'application/xhtml;q=0.5' would
get parsed into:
('application', 'xhtml', {'q', '0.5'})
t ;i t =i t *s */*t /( t splitt dictt tuplet strip(
t mime_typet partst _[1]t paramt _[2]t st paramst full_typet typet subtype( ( s8 /usr/lib/python2.6/site-packages/paste/util/mimeparse.pyt parse_mime_type s
Q
c C s t | \ } } } | i d pL | d p@ t | d p. t | d d j p t | d d j o d | d