Back to index

plone3  3.1.7
Functions
MimetypesRegistry.setuphandlers Namespace Reference

Functions

def fixUpSMIGlobs
def installMimetypesRegistry
def setupMimetypesRegistry

Detailed Description

MimetypesRegistry setup handlers.

Function Documentation

def MimetypesRegistry.setuphandlers.fixUpSMIGlobs (   portal,
  out = None 
)

Definition at line 9 of file setuphandlers.py.

00009 
00010 def fixUpSMIGlobs(portal, out=None):
00011     from Products.MimetypesRegistry.mime_types import smi_mimetypes
00012     from Products.Archetypes.debug import log
00013     mtr = getToolByName(portal, 'mimetypes_registry')
00014     smi_mimetypes.initialize(mtr)
00015 
00016     # Now comes the fun part. For every glob, lookup a extension
00017     # matching the glob and unregister it.
00018     for glob in mtr.globs.keys():
00019         if mtr.extensions.has_key(glob):
00020             log('Found glob %s in extensions registry, removing.' % glob)
00021             mti = mtr.extensions[glob]
00022             del mtr.extensions[glob]
00023             if glob in mti.extensions:
00024                 log('Found glob %s in mimetype %s extensions, '
00025                     'removing.' % (glob, mti))
00026                 exts = list(mti.extensions)
00027                 exts.remove(glob)
00028                 mti.extensions = tuple(exts)
00029                 mtr.register(mti)
00030 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 31 of file setuphandlers.py.

00031 
00032 def installMimetypesRegistry(portal):
00033     out = StringIO()
00034 
00035     fixUpSMIGlobs(portal, out)
00036 

Here is the call graph for this function:

Here is the caller graph for this function:

Setup MimetypesRegistry step.

Definition at line 37 of file setuphandlers.py.

00037 
00038 def setupMimetypesRegistry(context):
00039     """
00040     Setup MimetypesRegistry step.
00041     """
00042     # Only run step if a flag file is present (e.g. not an extension profile)
00043     if context.readDataFile('mimetypes-registry-various.txt') is None:
00044         return
00045     out = []
00046     site = context.getSite()
00047     installMimetypesRegistry(site)
00048 

Here is the call graph for this function: