Package web2py :: Package gluon :: Module contenttype
[hide private]
[frames] | no frames]

Source Code for Module web2py.gluon.contenttype

  1  #!/usr/bin/env python 
  2  # -*- coding: utf-8 -*- 
  3   
  4  """ 
  5  This file is part of the web2py Web Framework 
  6  Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> 
  7  License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) 
  8   
  9  CONTENT_TYPE dictionary created against freedesktop.org' shared mime info 
 10  database version 0.70. 
 11  """ 
 12   
 13  __all__ = ['contenttype'] 
 14   
 15  CONTENT_TYPE = { 
 16      '.load': 'text/html', 
 17      '.123': 'application/vnd.lotus-1-2-3', 
 18      '.3ds': 'image/x-3ds', 
 19      '.3g2': 'video/3gpp', 
 20      '.3ga': 'video/3gpp', 
 21      '.3gp': 'video/3gpp', 
 22      '.3gpp': 'video/3gpp', 
 23      '.602': 'application/x-t602', 
 24      '.669': 'audio/x-mod', 
 25      '.7z': 'application/x-7z-compressed', 
 26      '.a': 'application/x-archive', 
 27      '.aac': 'audio/mp4', 
 28      '.abw': 'application/x-abiword', 
 29      '.abw.crashed': 'application/x-abiword', 
 30      '.abw.gz': 'application/x-abiword', 
 31      '.ac3': 'audio/ac3', 
 32      '.ace': 'application/x-ace', 
 33      '.adb': 'text/x-adasrc', 
 34      '.ads': 'text/x-adasrc', 
 35      '.afm': 'application/x-font-afm', 
 36      '.ag': 'image/x-applix-graphics', 
 37      '.ai': 'application/illustrator', 
 38      '.aif': 'audio/x-aiff', 
 39      '.aifc': 'audio/x-aiff', 
 40      '.aiff': 'audio/x-aiff', 
 41      '.al': 'application/x-perl', 
 42      '.alz': 'application/x-alz', 
 43      '.amr': 'audio/amr', 
 44      '.ani': 'application/x-navi-animation', 
 45      '.anim[1-9j]': 'video/x-anim', 
 46      '.anx': 'application/annodex', 
 47      '.ape': 'audio/x-ape', 
 48      '.arj': 'application/x-arj', 
 49      '.arw': 'image/x-sony-arw', 
 50      '.as': 'application/x-applix-spreadsheet', 
 51      '.asc': 'text/plain', 
 52      '.asf': 'video/x-ms-asf', 
 53      '.asp': 'application/x-asp', 
 54      '.ass': 'text/x-ssa', 
 55      '.asx': 'audio/x-ms-asx', 
 56      '.atom': 'application/atom+xml', 
 57      '.au': 'audio/basic', 
 58      '.avi': 'video/x-msvideo', 
 59      '.aw': 'application/x-applix-word', 
 60      '.awb': 'audio/amr-wb', 
 61      '.awk': 'application/x-awk', 
 62      '.axa': 'audio/annodex', 
 63      '.axv': 'video/annodex', 
 64      '.bak': 'application/x-trash', 
 65      '.bcpio': 'application/x-bcpio', 
 66      '.bdf': 'application/x-font-bdf', 
 67      '.bib': 'text/x-bibtex', 
 68      '.bin': 'application/octet-stream', 
 69      '.blend': 'application/x-blender', 
 70      '.blender': 'application/x-blender', 
 71      '.bmp': 'image/bmp', 
 72      '.bz': 'application/x-bzip', 
 73      '.bz2': 'application/x-bzip', 
 74      '.c': 'text/x-csrc', 
 75      '.c++': 'text/x-c++src', 
 76      '.cab': 'application/vnd.ms-cab-compressed', 
 77      '.cb7': 'application/x-cb7', 
 78      '.cbr': 'application/x-cbr', 
 79      '.cbt': 'application/x-cbt', 
 80      '.cbz': 'application/x-cbz', 
 81      '.cc': 'text/x-c++src', 
 82      '.cdf': 'application/x-netcdf', 
 83      '.cdr': 'application/vnd.corel-draw', 
 84      '.cer': 'application/x-x509-ca-cert', 
 85      '.cert': 'application/x-x509-ca-cert', 
 86      '.cgm': 'image/cgm', 
 87      '.chm': 'application/x-chm', 
 88      '.chrt': 'application/x-kchart', 
 89      '.class': 'application/x-java', 
 90      '.cls': 'text/x-tex', 
 91      '.cmake': 'text/x-cmake', 
 92      '.cpio': 'application/x-cpio', 
 93      '.cpio.gz': 'application/x-cpio-compressed', 
 94      '.cpp': 'text/x-c++src', 
 95      '.cr2': 'image/x-canon-cr2', 
 96      '.crt': 'application/x-x509-ca-cert', 
 97      '.crw': 'image/x-canon-crw', 
 98      '.cs': 'text/x-csharp', 
 99      '.csh': 'application/x-csh', 
100      '.css': 'text/css', 
101      '.cssl': 'text/css', 
102      '.csv': 'text/csv', 
103      '.cue': 'application/x-cue', 
104      '.cur': 'image/x-win-bitmap', 
105      '.cxx': 'text/x-c++src', 
106      '.d': 'text/x-dsrc', 
107      '.dar': 'application/x-dar', 
108      '.dbf': 'application/x-dbf', 
109      '.dc': 'application/x-dc-rom', 
110      '.dcl': 'text/x-dcl', 
111      '.dcm': 'application/dicom', 
112      '.dcr': 'image/x-kodak-dcr', 
113      '.dds': 'image/x-dds', 
114      '.deb': 'application/x-deb', 
115      '.der': 'application/x-x509-ca-cert', 
116      '.desktop': 'application/x-desktop', 
117      '.dia': 'application/x-dia-diagram', 
118      '.diff': 'text/x-patch', 
119      '.divx': 'video/x-msvideo', 
120      '.djv': 'image/vnd.djvu', 
121      '.djvu': 'image/vnd.djvu', 
122      '.dng': 'image/x-adobe-dng', 
123      '.doc': 'application/msword', 
124      '.docbook': 'application/docbook+xml', 
125      '.docm': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 
126      '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 
127      '.dot': 'text/vnd.graphviz', 
128      '.dsl': 'text/x-dsl', 
129      '.dtd': 'application/xml-dtd', 
130      '.dtx': 'text/x-tex', 
131      '.dv': 'video/dv', 
132      '.dvi': 'application/x-dvi', 
133      '.dvi.bz2': 'application/x-bzdvi', 
134      '.dvi.gz': 'application/x-gzdvi', 
135      '.dwg': 'image/vnd.dwg', 
136      '.dxf': 'image/vnd.dxf', 
137      '.e': 'text/x-eiffel', 
138      '.egon': 'application/x-egon', 
139      '.eif': 'text/x-eiffel', 
140      '.el': 'text/x-emacs-lisp', 
141      '.emf': 'image/x-emf', 
142      '.emp': 'application/vnd.emusic-emusic_package', 
143      '.ent': 'application/xml-external-parsed-entity', 
144      '.eps': 'image/x-eps', 
145      '.eps.bz2': 'image/x-bzeps', 
146      '.eps.gz': 'image/x-gzeps', 
147      '.epsf': 'image/x-eps', 
148      '.epsf.bz2': 'image/x-bzeps', 
149      '.epsf.gz': 'image/x-gzeps', 
150      '.epsi': 'image/x-eps', 
151      '.epsi.bz2': 'image/x-bzeps', 
152      '.epsi.gz': 'image/x-gzeps', 
153      '.epub': 'application/epub+zip', 
154      '.erl': 'text/x-erlang', 
155      '.es': 'application/ecmascript', 
156      '.etheme': 'application/x-e-theme', 
157      '.etx': 'text/x-setext', 
158      '.exe': 'application/x-ms-dos-executable', 
159      '.exr': 'image/x-exr', 
160      '.ez': 'application/andrew-inset', 
161      '.f': 'text/x-fortran', 
162      '.f90': 'text/x-fortran', 
163      '.f95': 'text/x-fortran', 
164      '.fb2': 'application/x-fictionbook+xml', 
165      '.fig': 'image/x-xfig', 
166      '.fits': 'image/fits', 
167      '.fl': 'application/x-fluid', 
168      '.flac': 'audio/x-flac', 
169      '.flc': 'video/x-flic', 
170      '.fli': 'video/x-flic', 
171      '.flv': 'video/x-flv', 
172      '.flw': 'application/x-kivio', 
173      '.fo': 'text/x-xslfo', 
174      '.for': 'text/x-fortran', 
175      '.g3': 'image/fax-g3', 
176      '.gb': 'application/x-gameboy-rom', 
177      '.gba': 'application/x-gba-rom', 
178      '.gcrd': 'text/directory', 
179      '.ged': 'application/x-gedcom', 
180      '.gedcom': 'application/x-gedcom', 
181      '.gen': 'application/x-genesis-rom', 
182      '.gf': 'application/x-tex-gf', 
183      '.gg': 'application/x-sms-rom', 
184      '.gif': 'image/gif', 
185      '.glade': 'application/x-glade', 
186      '.gmo': 'application/x-gettext-translation', 
187      '.gnc': 'application/x-gnucash', 
188      '.gnd': 'application/gnunet-directory', 
189      '.gnucash': 'application/x-gnucash', 
190      '.gnumeric': 'application/x-gnumeric', 
191      '.gnuplot': 'application/x-gnuplot', 
192      '.gp': 'application/x-gnuplot', 
193      '.gpg': 'application/pgp-encrypted', 
194      '.gplt': 'application/x-gnuplot', 
195      '.gra': 'application/x-graphite', 
196      '.gsf': 'application/x-font-type1', 
197      '.gsm': 'audio/x-gsm', 
198      '.gtar': 'application/x-tar', 
199      '.gv': 'text/vnd.graphviz', 
200      '.gvp': 'text/x-google-video-pointer', 
201      '.gz': 'application/x-gzip', 
202      '.h': 'text/x-chdr', 
203      '.h++': 'text/x-c++hdr', 
204      '.hdf': 'application/x-hdf', 
205      '.hh': 'text/x-c++hdr', 
206      '.hp': 'text/x-c++hdr', 
207      '.hpgl': 'application/vnd.hp-hpgl', 
208      '.hpp': 'text/x-c++hdr', 
209      '.hs': 'text/x-haskell', 
210      '.htm': 'text/html', 
211      '.html': 'text/html', 
212      '.hwp': 'application/x-hwp', 
213      '.hwt': 'application/x-hwt', 
214      '.hxx': 'text/x-c++hdr', 
215      '.ica': 'application/x-ica', 
216      '.icb': 'image/x-tga', 
217      '.icns': 'image/x-icns', 
218      '.ico': 'image/vnd.microsoft.icon', 
219      '.ics': 'text/calendar', 
220      '.idl': 'text/x-idl', 
221      '.ief': 'image/ief', 
222      '.iff': 'image/x-iff', 
223      '.ilbm': 'image/x-ilbm', 
224      '.ime': 'text/x-imelody', 
225      '.imy': 'text/x-imelody', 
226      '.ins': 'text/x-tex', 
227      '.iptables': 'text/x-iptables', 
228      '.iso': 'application/x-cd-image', 
229      '.iso9660': 'application/x-cd-image', 
230      '.it': 'audio/x-it', 
231      '.j2k': 'image/jp2', 
232      '.jad': 'text/vnd.sun.j2me.app-descriptor', 
233      '.jar': 'application/x-java-archive', 
234      '.java': 'text/x-java', 
235      '.jng': 'image/x-jng', 
236      '.jnlp': 'application/x-java-jnlp-file', 
237      '.jp2': 'image/jp2', 
238      '.jpc': 'image/jp2', 
239      '.jpe': 'image/jpeg', 
240      '.jpeg': 'image/jpeg', 
241      '.jpf': 'image/jp2', 
242      '.jpg': 'image/jpeg', 
243      '.jpr': 'application/x-jbuilder-project', 
244      '.jpx': 'image/jp2', 
245      '.js': 'application/javascript', 
246      '.json': 'application/json', 
247      '.k25': 'image/x-kodak-k25', 
248      '.kar': 'audio/midi', 
249      '.karbon': 'application/x-karbon', 
250      '.kdc': 'image/x-kodak-kdc', 
251      '.kdelnk': 'application/x-desktop', 
252      '.kexi': 'application/x-kexiproject-sqlite3', 
253      '.kexic': 'application/x-kexi-connectiondata', 
254      '.kexis': 'application/x-kexiproject-shortcut', 
255      '.kfo': 'application/x-kformula', 
256      '.kil': 'application/x-killustrator', 
257      '.kino': 'application/smil', 
258      '.kml': 'application/vnd.google-earth.kml+xml', 
259      '.kmz': 'application/vnd.google-earth.kmz', 
260      '.kon': 'application/x-kontour', 
261      '.kpm': 'application/x-kpovmodeler', 
262      '.kpr': 'application/x-kpresenter', 
263      '.kpt': 'application/x-kpresenter', 
264      '.kra': 'application/x-krita', 
265      '.ksp': 'application/x-kspread', 
266      '.kud': 'application/x-kugar', 
267      '.kwd': 'application/x-kword', 
268      '.kwt': 'application/x-kword', 
269      '.la': 'application/x-shared-library-la', 
270      '.latex': 'text/x-tex', 
271      '.ldif': 'text/x-ldif', 
272      '.lha': 'application/x-lha', 
273      '.lhs': 'text/x-literate-haskell', 
274      '.lhz': 'application/x-lhz', 
275      '.log': 'text/x-log', 
276      '.ltx': 'text/x-tex', 
277      '.lua': 'text/x-lua', 
278      '.lwo': 'image/x-lwo', 
279      '.lwob': 'image/x-lwo', 
280      '.lws': 'image/x-lws', 
281      '.ly': 'text/x-lilypond', 
282      '.lyx': 'application/x-lyx', 
283      '.lz': 'application/x-lzip', 
284      '.lzh': 'application/x-lha', 
285      '.lzma': 'application/x-lzma', 
286      '.lzo': 'application/x-lzop', 
287      '.m': 'text/x-matlab', 
288      '.m15': 'audio/x-mod', 
289      '.m2t': 'video/mpeg', 
290      '.m3u': 'audio/x-mpegurl', 
291      '.m3u8': 'audio/x-mpegurl', 
292      '.m4': 'application/x-m4', 
293      '.m4a': 'audio/mp4', 
294      '.m4b': 'audio/x-m4b', 
295      '.m4v': 'video/mp4', 
296      '.mab': 'application/x-markaby', 
297      '.man': 'application/x-troff-man', 
298      '.mbox': 'application/mbox', 
299      '.md': 'application/x-genesis-rom', 
300      '.mdb': 'application/vnd.ms-access', 
301      '.mdi': 'image/vnd.ms-modi', 
302      '.me': 'text/x-troff-me', 
303      '.med': 'audio/x-mod', 
304      '.metalink': 'application/metalink+xml', 
305      '.mgp': 'application/x-magicpoint', 
306      '.mid': 'audio/midi', 
307      '.midi': 'audio/midi', 
308      '.mif': 'application/x-mif', 
309      '.minipsf': 'audio/x-minipsf', 
310      '.mka': 'audio/x-matroska', 
311      '.mkv': 'video/x-matroska', 
312      '.ml': 'text/x-ocaml', 
313      '.mli': 'text/x-ocaml', 
314      '.mm': 'text/x-troff-mm', 
315      '.mmf': 'application/x-smaf', 
316      '.mml': 'text/mathml', 
317      '.mng': 'video/x-mng', 
318      '.mo': 'application/x-gettext-translation', 
319      '.mo3': 'audio/x-mo3', 
320      '.moc': 'text/x-moc', 
321      '.mod': 'audio/x-mod', 
322      '.mof': 'text/x-mof', 
323      '.moov': 'video/quicktime', 
324      '.mov': 'video/quicktime', 
325      '.movie': 'video/x-sgi-movie', 
326      '.mp+': 'audio/x-musepack', 
327      '.mp2': 'video/mpeg', 
328      '.mp3': 'audio/mpeg', 
329      '.mp4': 'video/mp4', 
330      '.mpc': 'audio/x-musepack', 
331      '.mpe': 'video/mpeg', 
332      '.mpeg': 'video/mpeg', 
333      '.mpg': 'video/mpeg', 
334      '.mpga': 'audio/mpeg', 
335      '.mpp': 'audio/x-musepack', 
336      '.mrl': 'text/x-mrml', 
337      '.mrml': 'text/x-mrml', 
338      '.mrw': 'image/x-minolta-mrw', 
339      '.ms': 'text/x-troff-ms', 
340      '.msi': 'application/x-msi', 
341      '.msod': 'image/x-msod', 
342      '.msx': 'application/x-msx-rom', 
343      '.mtm': 'audio/x-mod', 
344      '.mup': 'text/x-mup', 
345      '.mxf': 'application/mxf', 
346      '.n64': 'application/x-n64-rom', 
347      '.nb': 'application/mathematica', 
348      '.nc': 'application/x-netcdf', 
349      '.nds': 'application/x-nintendo-ds-rom', 
350      '.nef': 'image/x-nikon-nef', 
351      '.nes': 'application/x-nes-rom', 
352      '.nfo': 'text/x-nfo', 
353      '.not': 'text/x-mup', 
354      '.nsc': 'application/x-netshow-channel', 
355      '.nsv': 'video/x-nsv', 
356      '.o': 'application/x-object', 
357      '.obj': 'application/x-tgif', 
358      '.ocl': 'text/x-ocl', 
359      '.oda': 'application/oda', 
360      '.odb': 'application/vnd.oasis.opendocument.database', 
361      '.odc': 'application/vnd.oasis.opendocument.chart', 
362      '.odf': 'application/vnd.oasis.opendocument.formula', 
363      '.odg': 'application/vnd.oasis.opendocument.graphics', 
364      '.odi': 'application/vnd.oasis.opendocument.image', 
365      '.odm': 'application/vnd.oasis.opendocument.text-master', 
366      '.odp': 'application/vnd.oasis.opendocument.presentation', 
367      '.ods': 'application/vnd.oasis.opendocument.spreadsheet', 
368      '.odt': 'application/vnd.oasis.opendocument.text', 
369      '.oga': 'audio/ogg', 
370      '.ogg': 'video/x-theora+ogg', 
371      '.ogm': 'video/x-ogm+ogg', 
372      '.ogv': 'video/ogg', 
373      '.ogx': 'application/ogg', 
374      '.old': 'application/x-trash', 
375      '.oleo': 'application/x-oleo', 
376      '.opml': 'text/x-opml+xml', 
377      '.ora': 'image/openraster', 
378      '.orf': 'image/x-olympus-orf', 
379      '.otc': 'application/vnd.oasis.opendocument.chart-template', 
380      '.otf': 'application/x-font-otf', 
381      '.otg': 'application/vnd.oasis.opendocument.graphics-template', 
382      '.oth': 'application/vnd.oasis.opendocument.text-web', 
383      '.otp': 'application/vnd.oasis.opendocument.presentation-template', 
384      '.ots': 'application/vnd.oasis.opendocument.spreadsheet-template', 
385      '.ott': 'application/vnd.oasis.opendocument.text-template', 
386      '.owl': 'application/rdf+xml', 
387      '.oxt': 'application/vnd.openofficeorg.extension', 
388      '.p': 'text/x-pascal', 
389      '.p10': 'application/pkcs10', 
390      '.p12': 'application/x-pkcs12', 
391      '.p7b': 'application/x-pkcs7-certificates', 
392      '.p7s': 'application/pkcs7-signature', 
393      '.pack': 'application/x-java-pack200', 
394      '.pak': 'application/x-pak', 
395      '.par2': 'application/x-par2', 
396      '.pas': 'text/x-pascal', 
397      '.patch': 'text/x-patch', 
398      '.pbm': 'image/x-portable-bitmap', 
399      '.pcd': 'image/x-photo-cd', 
400      '.pcf': 'application/x-cisco-vpn-settings', 
401      '.pcf.gz': 'application/x-font-pcf', 
402      '.pcf.z': 'application/x-font-pcf', 
403      '.pcl': 'application/vnd.hp-pcl', 
404      '.pcx': 'image/x-pcx', 
405      '.pdb': 'chemical/x-pdb', 
406      '.pdc': 'application/x-aportisdoc', 
407      '.pdf': 'application/pdf', 
408      '.pdf.bz2': 'application/x-bzpdf', 
409      '.pdf.gz': 'application/x-gzpdf', 
410      '.pef': 'image/x-pentax-pef', 
411      '.pem': 'application/x-x509-ca-cert', 
412      '.perl': 'application/x-perl', 
413      '.pfa': 'application/x-font-type1', 
414      '.pfb': 'application/x-font-type1', 
415      '.pfx': 'application/x-pkcs12', 
416      '.pgm': 'image/x-portable-graymap', 
417      '.pgn': 'application/x-chess-pgn', 
418      '.pgp': 'application/pgp-encrypted', 
419      '.php': 'application/x-php', 
420      '.php3': 'application/x-php', 
421      '.php4': 'application/x-php', 
422      '.pict': 'image/x-pict', 
423      '.pict1': 'image/x-pict', 
424      '.pict2': 'image/x-pict', 
425      '.pickle': 'application/python-pickle', 
426      '.pk': 'application/x-tex-pk', 
427      '.pkipath': 'application/pkix-pkipath', 
428      '.pkr': 'application/pgp-keys', 
429      '.pl': 'application/x-perl', 
430      '.pla': 'audio/x-iriver-pla', 
431      '.pln': 'application/x-planperfect', 
432      '.pls': 'audio/x-scpls', 
433      '.pm': 'application/x-perl', 
434      '.png': 'image/png', 
435      '.pnm': 'image/x-portable-anymap', 
436      '.pntg': 'image/x-macpaint', 
437      '.po': 'text/x-gettext-translation', 
438      '.por': 'application/x-spss-por', 
439      '.pot': 'text/x-gettext-translation-template', 
440      '.ppm': 'image/x-portable-pixmap', 
441      '.pps': 'application/vnd.ms-powerpoint', 
442      '.ppt': 'application/vnd.ms-powerpoint', 
443      '.pptm': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 
444      '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 
445      '.ppz': 'application/vnd.ms-powerpoint', 
446      '.prc': 'application/x-palm-database', 
447      '.ps': 'application/postscript', 
448      '.ps.bz2': 'application/x-bzpostscript', 
449      '.ps.gz': 'application/x-gzpostscript', 
450      '.psd': 'image/vnd.adobe.photoshop', 
451      '.psf': 'audio/x-psf', 
452      '.psf.gz': 'application/x-gz-font-linux-psf', 
453      '.psflib': 'audio/x-psflib', 
454      '.psid': 'audio/prs.sid', 
455      '.psw': 'application/x-pocket-word', 
456      '.pw': 'application/x-pw', 
457      '.py': 'text/x-python', 
458      '.pyc': 'application/x-python-bytecode', 
459      '.pyo': 'application/x-python-bytecode', 
460      '.qif': 'image/x-quicktime', 
461      '.qt': 'video/quicktime', 
462      '.qtif': 'image/x-quicktime', 
463      '.qtl': 'application/x-quicktime-media-link', 
464      '.qtvr': 'video/quicktime', 
465      '.ra': 'audio/vnd.rn-realaudio', 
466      '.raf': 'image/x-fuji-raf', 
467      '.ram': 'application/ram', 
468      '.rar': 'application/x-rar', 
469      '.ras': 'image/x-cmu-raster', 
470      '.raw': 'image/x-panasonic-raw', 
471      '.rax': 'audio/vnd.rn-realaudio', 
472      '.rb': 'application/x-ruby', 
473      '.rdf': 'application/rdf+xml', 
474      '.rdfs': 'application/rdf+xml', 
475      '.reg': 'text/x-ms-regedit', 
476      '.rej': 'application/x-reject', 
477      '.rgb': 'image/x-rgb', 
478      '.rle': 'image/rle', 
479      '.rm': 'application/vnd.rn-realmedia', 
480      '.rmj': 'application/vnd.rn-realmedia', 
481      '.rmm': 'application/vnd.rn-realmedia', 
482      '.rms': 'application/vnd.rn-realmedia', 
483      '.rmvb': 'application/vnd.rn-realmedia', 
484      '.rmx': 'application/vnd.rn-realmedia', 
485      '.roff': 'text/troff', 
486      '.rp': 'image/vnd.rn-realpix', 
487      '.rpm': 'application/x-rpm', 
488      '.rss': 'application/rss+xml', 
489      '.rt': 'text/vnd.rn-realtext', 
490      '.rtf': 'application/rtf', 
491      '.rtx': 'text/richtext', 
492      '.rv': 'video/vnd.rn-realvideo', 
493      '.rvx': 'video/vnd.rn-realvideo', 
494      '.s3m': 'audio/x-s3m', 
495      '.sam': 'application/x-amipro', 
496      '.sami': 'application/x-sami', 
497      '.sav': 'application/x-spss-sav', 
498      '.scm': 'text/x-scheme', 
499      '.sda': 'application/vnd.stardivision.draw', 
500      '.sdc': 'application/vnd.stardivision.calc', 
501      '.sdd': 'application/vnd.stardivision.impress', 
502      '.sdp': 'application/sdp', 
503      '.sds': 'application/vnd.stardivision.chart', 
504      '.sdw': 'application/vnd.stardivision.writer', 
505      '.sgf': 'application/x-go-sgf', 
506      '.sgi': 'image/x-sgi', 
507      '.sgl': 'application/vnd.stardivision.writer', 
508      '.sgm': 'text/sgml', 
509      '.sgml': 'text/sgml', 
510      '.sh': 'application/x-shellscript', 
511      '.shar': 'application/x-shar', 
512      '.shn': 'application/x-shorten', 
513      '.siag': 'application/x-siag', 
514      '.sid': 'audio/prs.sid', 
515      '.sik': 'application/x-trash', 
516      '.sis': 'application/vnd.symbian.install', 
517      '.sisx': 'x-epoc/x-sisx-app', 
518      '.sit': 'application/x-stuffit', 
519      '.siv': 'application/sieve', 
520      '.sk': 'image/x-skencil', 
521      '.sk1': 'image/x-skencil', 
522      '.skr': 'application/pgp-keys', 
523      '.slk': 'text/spreadsheet', 
524      '.smaf': 'application/x-smaf', 
525      '.smc': 'application/x-snes-rom', 
526      '.smd': 'application/vnd.stardivision.mail', 
527      '.smf': 'application/vnd.stardivision.math', 
528      '.smi': 'application/x-sami', 
529      '.smil': 'application/smil', 
530      '.sml': 'application/smil', 
531      '.sms': 'application/x-sms-rom', 
532      '.snd': 'audio/basic', 
533      '.so': 'application/x-sharedlib', 
534      '.spc': 'application/x-pkcs7-certificates', 
535      '.spd': 'application/x-font-speedo', 
536      '.spec': 'text/x-rpm-spec', 
537      '.spl': 'application/x-shockwave-flash', 
538      '.spx': 'audio/x-speex', 
539      '.sql': 'text/x-sql', 
540      '.sr2': 'image/x-sony-sr2', 
541      '.src': 'application/x-wais-source', 
542      '.srf': 'image/x-sony-srf', 
543      '.srt': 'application/x-subrip', 
544      '.ssa': 'text/x-ssa', 
545      '.stc': 'application/vnd.sun.xml.calc.template', 
546      '.std': 'application/vnd.sun.xml.draw.template', 
547      '.sti': 'application/vnd.sun.xml.impress.template', 
548      '.stm': 'audio/x-stm', 
549      '.stw': 'application/vnd.sun.xml.writer.template', 
550      '.sty': 'text/x-tex', 
551      '.sub': 'text/x-subviewer', 
552      '.sun': 'image/x-sun-raster', 
553      '.sv4cpio': 'application/x-sv4cpio', 
554      '.sv4crc': 'application/x-sv4crc', 
555      '.svg': 'image/svg+xml', 
556      '.svgz': 'image/svg+xml-compressed', 
557      '.swf': 'application/x-shockwave-flash', 
558      '.sxc': 'application/vnd.sun.xml.calc', 
559      '.sxd': 'application/vnd.sun.xml.draw', 
560      '.sxg': 'application/vnd.sun.xml.writer.global', 
561      '.sxi': 'application/vnd.sun.xml.impress', 
562      '.sxm': 'application/vnd.sun.xml.math', 
563      '.sxw': 'application/vnd.sun.xml.writer', 
564      '.sylk': 'text/spreadsheet', 
565      '.t': 'text/troff', 
566      '.t2t': 'text/x-txt2tags', 
567      '.tar': 'application/x-tar', 
568      '.tar.bz': 'application/x-bzip-compressed-tar', 
569      '.tar.bz2': 'application/x-bzip-compressed-tar', 
570      '.tar.gz': 'application/x-compressed-tar', 
571      '.tar.lzma': 'application/x-lzma-compressed-tar', 
572      '.tar.lzo': 'application/x-tzo', 
573      '.tar.xz': 'application/x-xz-compressed-tar', 
574      '.tar.z': 'application/x-tarz', 
575      '.tbz': 'application/x-bzip-compressed-tar', 
576      '.tbz2': 'application/x-bzip-compressed-tar', 
577      '.tcl': 'text/x-tcl', 
578      '.tex': 'text/x-tex', 
579      '.texi': 'text/x-texinfo', 
580      '.texinfo': 'text/x-texinfo', 
581      '.tga': 'image/x-tga', 
582      '.tgz': 'application/x-compressed-tar', 
583      '.theme': 'application/x-theme', 
584      '.themepack': 'application/x-windows-themepack', 
585      '.tif': 'image/tiff', 
586      '.tiff': 'image/tiff', 
587      '.tk': 'text/x-tcl', 
588      '.tlz': 'application/x-lzma-compressed-tar', 
589      '.tnef': 'application/vnd.ms-tnef', 
590      '.tnf': 'application/vnd.ms-tnef', 
591      '.toc': 'application/x-cdrdao-toc', 
592      '.torrent': 'application/x-bittorrent', 
593      '.tpic': 'image/x-tga', 
594      '.tr': 'text/troff', 
595      '.ts': 'application/x-linguist', 
596      '.tsv': 'text/tab-separated-values', 
597      '.tta': 'audio/x-tta', 
598      '.ttc': 'application/x-font-ttf', 
599      '.ttf': 'application/x-font-ttf', 
600      '.ttx': 'application/x-font-ttx', 
601      '.txt': 'text/plain', 
602      '.txz': 'application/x-xz-compressed-tar', 
603      '.tzo': 'application/x-tzo', 
604      '.ufraw': 'application/x-ufraw', 
605      '.ui': 'application/x-designer', 
606      '.uil': 'text/x-uil', 
607      '.ult': 'audio/x-mod', 
608      '.uni': 'audio/x-mod', 
609      '.uri': 'text/x-uri', 
610      '.url': 'text/x-uri', 
611      '.ustar': 'application/x-ustar', 
612      '.vala': 'text/x-vala', 
613      '.vapi': 'text/x-vala', 
614      '.vcf': 'text/directory', 
615      '.vcs': 'text/calendar', 
616      '.vct': 'text/directory', 
617      '.vda': 'image/x-tga', 
618      '.vhd': 'text/x-vhdl', 
619      '.vhdl': 'text/x-vhdl', 
620      '.viv': 'video/vivo', 
621      '.vivo': 'video/vivo', 
622      '.vlc': 'audio/x-mpegurl', 
623      '.vob': 'video/mpeg', 
624      '.voc': 'audio/x-voc', 
625      '.vor': 'application/vnd.stardivision.writer', 
626      '.vst': 'image/x-tga', 
627      '.wav': 'audio/x-wav', 
628      '.wax': 'audio/x-ms-asx', 
629      '.wb1': 'application/x-quattropro', 
630      '.wb2': 'application/x-quattropro', 
631      '.wb3': 'application/x-quattropro', 
632      '.wbmp': 'image/vnd.wap.wbmp', 
633      '.wcm': 'application/vnd.ms-works', 
634      '.wdb': 'application/vnd.ms-works', 
635      '.wk1': 'application/vnd.lotus-1-2-3', 
636      '.wk3': 'application/vnd.lotus-1-2-3', 
637      '.wk4': 'application/vnd.lotus-1-2-3', 
638      '.wks': 'application/vnd.ms-works', 
639      '.wma': 'audio/x-ms-wma', 
640      '.wmf': 'image/x-wmf', 
641      '.wml': 'text/vnd.wap.wml', 
642      '.wmls': 'text/vnd.wap.wmlscript', 
643      '.wmv': 'video/x-ms-wmv', 
644      '.wmx': 'audio/x-ms-asx', 
645      '.wp': 'application/vnd.wordperfect', 
646      '.wp4': 'application/vnd.wordperfect', 
647      '.wp5': 'application/vnd.wordperfect', 
648      '.wp6': 'application/vnd.wordperfect', 
649      '.wpd': 'application/vnd.wordperfect', 
650      '.wpg': 'application/x-wpg', 
651      '.wpl': 'application/vnd.ms-wpl', 
652      '.wpp': 'application/vnd.wordperfect', 
653      '.wps': 'application/vnd.ms-works', 
654      '.wri': 'application/x-mswrite', 
655      '.wrl': 'model/vrml', 
656      '.wv': 'audio/x-wavpack', 
657      '.wvc': 'audio/x-wavpack-correction', 
658      '.wvp': 'audio/x-wavpack', 
659      '.wvx': 'audio/x-ms-asx', 
660      '.x3f': 'image/x-sigma-x3f', 
661      '.xac': 'application/x-gnucash', 
662      '.xbel': 'application/x-xbel', 
663      '.xbl': 'application/xml', 
664      '.xbm': 'image/x-xbitmap', 
665      '.xcf': 'image/x-xcf', 
666      '.xcf.bz2': 'image/x-compressed-xcf', 
667      '.xcf.gz': 'image/x-compressed-xcf', 
668      '.xhtml': 'application/xhtml+xml', 
669      '.xi': 'audio/x-xi', 
670      '.xla': 'application/vnd.ms-excel', 
671      '.xlc': 'application/vnd.ms-excel', 
672      '.xld': 'application/vnd.ms-excel', 
673      '.xlf': 'application/x-xliff', 
674      '.xliff': 'application/x-xliff', 
675      '.xll': 'application/vnd.ms-excel', 
676      '.xlm': 'application/vnd.ms-excel', 
677      '.xls': 'application/vnd.ms-excel', 
678      '.xlsm': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 
679      '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 
680      '.xlt': 'application/vnd.ms-excel', 
681      '.xlw': 'application/vnd.ms-excel', 
682      '.xm': 'audio/x-xm', 
683      '.xmf': 'audio/x-xmf', 
684      '.xmi': 'text/x-xmi', 
685      '.xml': 'application/xml', 
686      '.xpm': 'image/x-xpixmap', 
687      '.xps': 'application/vnd.ms-xpsdocument', 
688      '.xsl': 'application/xml', 
689      '.xslfo': 'text/x-xslfo', 
690      '.xslt': 'application/xml', 
691      '.xspf': 'application/xspf+xml', 
692      '.xul': 'application/vnd.mozilla.xul+xml', 
693      '.xwd': 'image/x-xwindowdump', 
694      '.xyz': 'chemical/x-pdb', 
695      '.xz': 'application/x-xz', 
696      '.w2p': 'application/w2p', 
697      '.z': 'application/x-compress', 
698      '.zabw': 'application/x-abiword', 
699      '.zip': 'application/zip', 
700      '.zoo': 'application/x-zoo', 
701      } 
702   
703   
704 -def contenttype(filename, default='text/plain'):
705 """ 706 Returns the Content-Type string matching extension of the given filename. 707 """ 708 709 i = filename.rfind('.') 710 if i>=0: 711 default = CONTENT_TYPE.get(filename[i:].lower(),default) 712 j = filename.rfind('.', 0, i) 713 if j>=0: 714 default = CONTENT_TYPE.get(filename[j:].lower(),default) 715 if default.startswith('text/'): 716 default += '; charset=utf-8' 717 return default
718