?
| Path : /lib64/python2.7/ |
| Current File : //lib64/python2.7/mailcap.pyo |
ó
zfc @ sê d Z d d l Z d d l Z d d l Z d d g Z e j d ƒ j Z d e f d „ ƒ YZ d „ Z
d „ Z d
„ Z d „ Z
d „ Z d
d g d „ Z d d „ Z g d „ Z d „ Z d „ Z d „ Z e d k ræ e ƒ n d S( s% Mailcap file handling. See RFC 1524.iÿÿÿÿNt getcapst findmatchs [^\xa1-\xff\w@+=:,./-]t UnsafeMailcapInputc B s e Z d Z RS( s) Warning raised when refusing unsafe input( t __name__t
__module__t __doc__( ( ( s /usr/lib64/python2.7/mailcap.pyR s c C s© i } xœ t ƒ D]‘ } y t | d ƒ } Wn t k
r? q n X| t | ƒ } Wd QXxE | j ƒ D]7 \ } } | | k r‹ | | | <qf | | | | | <qf Wq W| S( s Return a dictionary containing the mailcap database.
The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
to a list of dictionaries corresponding to mailcap entries. The list
collects all the entries for that MIME type from all available mailcap
files. Each dictionary contains key-value pairs for that MIME type,
where the viewing command is stored with the key "view".
t rN( t listmailcapfilest opent IOErrort readmailcapfilet iteritems( t capst mailcapt fpt morecapst keyt value( ( s /usr/lib64/python2.7/mailcap.pyR s
c C sm d t j k r. t j d } | j d ƒ } n; d t j k rM t j d } n d } | d d d d g } | S( s7 Return a list of all mailcap files found on the system.t MAILCAPSt :t HOMEt .s /.mailcaps /etc/mailcaps /usr/etc/mailcaps /usr/local/etc/mailcap( t ost environt split( t strt mailcapst home( ( s /usr/lib64/python2.7/mailcap.pyR + s
c C s; i } x.| j ƒ } | s Pn | d d k s | j ƒ d k rG q n | } x= | d d k rŒ | j ƒ } | s{ d } n | d | } qP Wt | ƒ \ } } | o¨ | s± q n | j d ƒ } x. t t | ƒ ƒ D] } | | j ƒ | | <qÓ Wd j | ƒ j ƒ } | | k r&| | j | ƒ q | g | | <q W| S( s Read a mailcap file and return a dictionary keyed by MIME type.
Each MIME type is mapped to an entry consisting of a list of
dictionaries; the list will contain more than one such dictionary
if a given MIME type appears more than once in the mailcap file.
Each dictionary contains key-value pairs for that MIME type, where
the viewing command is stored with the key "view".
i t #t iþÿÿÿs \
s
t /( t readlinet stript parselineR t ranget lent joint lowert append( R R t linet nextlineR t fieldst typest j( ( s /usr/lib64/python2.7/mailcap.pyR
>