Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / mimetypes-objects.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="prev" href="module-mimetypes.html" />
13<link rel="parent" href="module-mimetypes.html" />
14<link rel="next" href="module-MimeWriter.html" />
15<meta name='aesop' content='information' />
16<title>12.7.1 MimeTypes Objects </title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="12.7 mimetypes "
24 href="module-mimetypes.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="12.7 mimetypes "
27 href="module-mimetypes.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="12.8 MimeWriter "
30 href="module-MimeWriter.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Python Library Reference</td>
33<td class='online-navigation'><a rel="contents" title="Table of Contents"
34 href="contents.html"><img src='../icons/contents.png'
35 border='0' height='32' alt='Contents' width='32' /></A></td>
36<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
37 border='0' height='32' alt='Module Index' width='32' /></a></td>
38<td class='online-navigation'><a rel="index" title="Index"
39 href="genindex.html"><img src='../icons/index.png'
40 border='0' height='32' alt='Index' width='32' /></A></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="module-mimetypes.html">12.7 mimetypes </A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="module-mimetypes.html">12.7 mimetypes </A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="module-MimeWriter.html">12.8 MimeWriter </A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H2><A NAME="SECTION0014710000000000000000"></A><A NAME="mimetypes-objects"></A>
55<BR>
5612.7.1 MimeTypes Objects
57</H2>
58
59<P>
60<tt class="class">MimeTypes</tt> instances provide an interface which is very like
61that of the <tt class="module"><a href="module-mimetypes.html">mimetypes</a></tt> module.
62
63<P>
64<dl><dt><b><tt id='l2h-4035' xml:id='l2h-4035'>suffix_map</tt></b></dt>
65<dd>
66 Dictionary mapping suffixes to suffixes. This is used to allow
67 recognition of encoded files for which the encoding and the type are
68 indicated by the same extension. For example, the <span class="file">.tgz</span>
69 extension is mapped to <span class="file">.tar.gz</span> to allow the encoding and type
70 to be recognized separately. This is initially a copy of the global
71 <code>suffix_map</code> defined in the module.
72</dd></dl>
73
74<P>
75<dl><dt><b><tt id='l2h-4036' xml:id='l2h-4036'>encodings_map</tt></b></dt>
76<dd>
77 Dictionary mapping filename extensions to encoding types. This is
78 initially a copy of the global <code>encodings_map</code> defined in the
79 module.
80</dd></dl>
81
82<P>
83<dl><dt><b><tt id='l2h-4037' xml:id='l2h-4037'>types_map</tt></b></dt>
84<dd>
85 Dictionary mapping filename extensions to MIME types. This is
86 initially a copy of the global <code>types_map</code> defined in the
87 module.
88</dd></dl>
89
90<P>
91<dl><dt><b><tt id='l2h-4038' xml:id='l2h-4038'>common_types</tt></b></dt>
92<dd>
93 Dictionary mapping filename extensions to non-standard, but commonly
94 found MIME types. This is initially a copy of the global
95 <code>common_types</code> defined in the module.
96</dd></dl>
97
98<P>
99<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
100 <td><nobr><b><tt id='l2h-4039' xml:id='l2h-4039' class="method">guess_extension</tt></b>(</nobr></td>
101 <td><var>type</var><big>[</big><var>, strict</var><big>]</big><var></var>)</td></tr></table></dt>
102<dd>
103 Similar to the <tt class="function">guess_extension()</tt> function, using the
104 tables stored as part of the object.
105</dl>
106
107<P>
108<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
109 <td><nobr><b><tt id='l2h-4040' xml:id='l2h-4040' class="method">guess_type</tt></b>(</nobr></td>
110 <td><var>url</var><big>[</big><var>, strict</var><big>]</big><var></var>)</td></tr></table></dt>
111<dd>
112 Similar to the <tt class="function">guess_type()</tt> function, using the tables
113 stored as part of the object.
114</dl>
115
116<P>
117<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
118 <td><nobr><b><tt id='l2h-4041' xml:id='l2h-4041' class="method">read</tt></b>(</nobr></td>
119 <td><var>path</var>)</td></tr></table></dt>
120<dd>
121 Load MIME information from a file named <var>path</var>. This uses
122 <tt class="method">readfp()</tt> to parse the file.
123</dl>
124
125<P>
126<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
127 <td><nobr><b><tt id='l2h-4042' xml:id='l2h-4042' class="method">readfp</tt></b>(</nobr></td>
128 <td><var>file</var>)</td></tr></table></dt>
129<dd>
130 Load MIME type information from an open file. The file must have
131 the format of the standard <span class="file">mime.types</span> files.
132</dl>
133
134<DIV CLASS="navigation">
135<div class='online-navigation'>
136<p></p><hr />
137<table align="center" width="100%" cellpadding="0" cellspacing="2">
138<tr>
139<td class='online-navigation'><a rel="prev" title="12.7 mimetypes "
140 href="module-mimetypes.html"><img src='../icons/previous.png'
141 border='0' height='32' alt='Previous Page' width='32' /></A></td>
142<td class='online-navigation'><a rel="parent" title="12.7 mimetypes "
143 href="module-mimetypes.html"><img src='../icons/up.png'
144 border='0' height='32' alt='Up One Level' width='32' /></A></td>
145<td class='online-navigation'><a rel="next" title="12.8 MimeWriter "
146 href="module-MimeWriter.html"><img src='../icons/next.png'
147 border='0' height='32' alt='Next Page' width='32' /></A></td>
148<td align="center" width="100%">Python Library Reference</td>
149<td class='online-navigation'><a rel="contents" title="Table of Contents"
150 href="contents.html"><img src='../icons/contents.png'
151 border='0' height='32' alt='Contents' width='32' /></A></td>
152<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
153 border='0' height='32' alt='Module Index' width='32' /></a></td>
154<td class='online-navigation'><a rel="index" title="Index"
155 href="genindex.html"><img src='../icons/index.png'
156 border='0' height='32' alt='Index' width='32' /></A></td>
157</tr></table>
158<div class='online-navigation'>
159<b class="navlabel">Previous:</b>
160<a class="sectref" rel="prev" href="module-mimetypes.html">12.7 mimetypes </A>
161<b class="navlabel">Up:</b>
162<a class="sectref" rel="parent" href="module-mimetypes.html">12.7 mimetypes </A>
163<b class="navlabel">Next:</b>
164<a class="sectref" rel="next" href="module-MimeWriter.html">12.8 MimeWriter </A>
165</div>
166</div>
167<hr />
168<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
169</DIV>
170<!--End of Navigation Panel-->
171<ADDRESS>
172See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
173</ADDRESS>
174</BODY>
175</HTML>