Back to index

plone3  3.1.7
Functions | Variables
MimetypesRegistry.mime_types.py_mimetypes Namespace Reference

Functions

def mimes_initialize
def initialize

Variables

 mimes_initialized = False
tuple skip_extensions

Function Documentation

Definition at line 32 of file py_mimetypes.py.

00032 
00033 def initialize(registry):
00034     # Find things that are not in the specially registered mimetypes
00035     # and add them using some default policy, none of these will impl
00036     # iclassifier
00037 
00038     # Read our included mime.types file, in addition to whatever the
00039     # mimetypes python module might have found.
00040     mimes_initialize()
00041 
00042     # Initialize from registry known mimetypes if we are on Windows
00043     # and pywin32 is available.
00044     try:
00045         from windows_mimetypes import initialize
00046         initialize()
00047     except ImportError:
00048         pass
00049     
00050     for ext, mt in pymimetypes.types_map.items():
00051         if not ext:
00052             continue
00053         if ext.startswith('.'):
00054             ext = ext[1:]
00055         if registry.lookupExtension(ext):
00056             continue
00057         if ext in skip_extensions:
00058             continue
00059 
00060         try:
00061             mto =  registry.lookup(mt)
00062         except MimeTypeException:
00063             # malformed MIME type
00064             continue
00065         if mto:
00066             mto = mto[0]
00067             if not ext in mto.extensions:
00068                 registry.register_extension(ext, mto)
00069                 mto.extensions += (ext, )
00070                 # here we guess icon path again, to find icon match the new ext
00071                 mto.icon_path = guess_icon_path(mto)
00072             continue
00073         isBin = mt.split('/', 1)[0] != "text"
00074         registry.register(MimeTypeItem(mt, (mt,), (ext,), isBin))

Here is the call graph for this function:

Definition at line 18 of file py_mimetypes.py.

00018 
00019 def mimes_initialize():
00020     global mimes_initialized
00021     if mimes_initialized:
00022         return
00023     mimes_initialized = True
00024     # Augment known mime-types.
00025     here = os.path.dirname(os.path.abspath(__file__))
00026     add_files([os.path.join(here, 'mime.types')])
00027 
00028 # don't register the mimetype from python mimetypes if matching on of
# this extensions.

Here is the caller graph for this function:


Variable Documentation

Definition at line 16 of file py_mimetypes.py.

Initial value:
00001 (
00002     )

Definition at line 29 of file py_mimetypes.py.