PageRenderTime 83ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/gluon/contenttype.py

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