KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.4/mailcap.pyc
mò
‚=5Dc@s©dZdkZddgZd„Zd„Zd„Zd„Zd„Zd	d
gd„Zdd„Z
gd
„Zd„Zd„Z
d„Zedjoe
ƒndS(s%Mailcap file handling.  See RFC 1524.Ntgetcapst	findmatchcCsªh}xtƒD]’}yt|dƒ}Wntj
o
qnXt|ƒ}|iƒxG|i	ƒD]9\}}||jo|||<qe|||||<qeWqW|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".

    trN(tcapstlistmailcapfilestmailcaptopentfptIOErrortreadmailcapfiletmorecapstcloset	iteritemstkeytvalue(RRR
RRR
((t/usr/lib64/python2.4/mailcap.pyR	s 	



cCsqdtijo tid}|idƒ}n>dtijotid}nd}|ddddg}|S(
s7Return a list of all mailcap files found on the system.tMAILCAPSt:tHOMEt.s	/.mailcaps/etc/mailcaps/usr/etc/mailcaps/usr/local/etc/mailcapN(tostenvirontstrtsplittmailcapsthome(RRR((RR"s
cCsJh}x=|iƒ}|pPn|ddjp|iƒdjoq	n|}xA|ddjo/|iƒ}|p
d}n|d |}qUWt|ƒ\}}|o|pq	n|i	dƒ}x.tt|ƒƒD]}||iƒ||<qßWdi|ƒiƒ}||jo||i|ƒq	|g||<q	W|S(
sRead 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".
    iit#tiþÿÿÿs\
s
t/N(RRtreadlinetlinetstriptnextlinet	parselineR
tfieldsRttypestrangetlentjtjointlowertappend(RR R"R&RR
RR#((RR	5s8$

c
Cs-g}dt|ƒ}}xA||jo3t|||ƒ\}}|i|ƒ|d}qWt|ƒdjodSn|d|d|d}}	}hd|	<}xy|D]q}|idƒ}|djo|}d}n%|| iƒ}||diƒ}||joq®|||<q®W||fS(	sÈParse one entry in a mailcap file and return a dictionary.

    The viewing command is stored as the value with the key "view",
    and the rest of the fields produce key-value pairs in the dict.
    iiitviewt=RN(NN(R"R%Rtitnt
parsefieldtfieldR)tNoneR
R*tresttfindtfkeytfvalueR(
RR,R"R-R/R1R
R3R4R*((RR![s0

 


cCss|}xS||joE||}|djoPq	|djo|d}q	|d}q	W|||!iƒ|fS(s/Separate one key-value pair in a mailcap entry.t;s\iiN(R,tstartR-RtcR(RR,R-R6R7((RR.zs



R*s	/dev/nullc	Cs•t|||ƒ}x||D]t}d|jo>t|d||ƒ}|ot
i|ƒdjoqqjnt|||||ƒ}||fSqWdS(sFind a match for a mailcap entry.

    Return a tuple containing the command line, and the mailcap entry
    used; (None, None) if no match is found.  This may invoke the
    'test' command of several matching entries before deciding which
    entry to use.

    ttestiN(NN(tlookupRtMIMEtypeR
tentriestetsubsttfilenametplistR8RtsystemtcommandR0(	RR:R
R>R?R<R;R8RA((RRŠs
cCs‹g}||jo|||}n|idƒ}|dd}||jo|||}n|dj	ot|d„|ƒ}n|S(NRis/*cCs
||jS(N(R
R<(R<R
((Rt<lambda>§s(R;R:RRt	MIMEtypesR
R0tfilter(RR:R
RCR;((RR9žs


c
Csqd}dt|ƒ}}	xQ||	joC||}|d}|djo:|djo|||d!}|d}n||}q||}|d}|djo||}q|djo||}q|djo||}q|djod|}x-||	jo||d	jo|d}qÿW|||!}|d}|t
||ƒ}q|d|}qW|S(
NRiit%s\tsttt{t}(tresR%R/R,R-R7R>R:R6tnamet	findparamR?(
R/R:R>R?R7RKR6R,RJR-((RR=ªs4








cCsT|iƒd}t|ƒ}x1|D])}|| iƒ|jo||Sq#q#WdS(NR+R(RKR(R%R-R?tp(RKR?RMR-((RRLÊsc	Csÿdk}tƒ}|idpt|ƒdSnxÆtdt|iƒdƒD]©}|i||d!}t|ƒdjo
dGHdSn|d}|d}t||d|ƒ\}}|p
dGtGHqNdG|GHti|ƒ}|o
dG|GHqNqNWdS(	Niis"usage: mailcap [MIMEtype file] ...iR*sNo viewer found fors
Executing:sExit status:(tsysRRtargvtshowR$R%R,targsR:tfileRRAR<ttypeRR@tsts(	R:R<RQRRNR,RARRRT((RR8Õs(		



	cCsÁdGHxtƒD]}d|GHqWH|p
tƒ}ndGHH|iƒ}|iƒxg|D]_}|GH||}xG|D]?}|iƒ}|iƒx|D]}d|G||GHq™WHqvWqZWdS(NsMailcap files:s	sMailcap entries:s  %-15s(RtfnRRtkeystckeystsortRSR;R<tk(RR<RWRVR;RSRYRU((RRPës.





t__main__(t__doc__Rt__all__RRR	R!R.RR0R9R=RLR8RPt__name__(
R.R\RLRRPRRR	R9R!R8R=R((Rt?s				&		 			


Anon7 - 2021