Back to index

plone3  3.1.7
Functions
Archetypes.mimetype_utils Namespace Reference

Functions

def getDefaultContentType
def setDefaultContentType
def getAllowedContentTypes
def getAllowableContentTypes
def setForbiddenContentTypes
def getForbiddenContentTypes

Function Documentation

retrieves the list of installed content types by querying portal transforms. 

Definition at line 26 of file mimetype_utils.py.

00026 
00027 def getAllowableContentTypes(context):
00028     """ retrieves the list of installed content types by querying portal transforms. """
00029     portal_transforms = getToolByName(context, 'portal_transforms')
00030     return portal_transforms.listAvailableTextInputs()

Here is the call graph for this function:

Here is the caller graph for this function:

computes the list of allowed content types by subtracting the site property blacklist 
    from the list of installed types.

Definition at line 17 of file mimetype_utils.py.

00017 
00018 def getAllowedContentTypes(context):
00019     """ computes the list of allowed content types by subtracting the site property blacklist 
00020         from the list of installed types.
00021     """
00022     allowable_types = getAllowableContentTypes(context)
00023     forbidden_types = getForbiddenContentTypes(context)
00024     allowed_types = [type for type in allowable_types if type not in forbidden_types]
00025     return allowed_types
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 7 of file mimetype_utils.py.

00007 
00008 def getDefaultContentType(context):
00009     portal_properties = getToolByName(context, 'portal_properties', None)
00010     site_properties = getattr(portal_properties, 'site_properties', None)
00011     return site_properties.getProperty('default_contenttype')

Here is the call graph for this function:

Here is the caller graph for this function:

Convenence method for retrevng the site property 'forbidden_contenttypes'.

Definition at line 37 of file mimetype_utils.py.

00037 
00038 def getForbiddenContentTypes(context):
00039     """ Convenence method for retrevng the site property 'forbidden_contenttypes'."""
00040     portal_properties = getToolByName(context, 'portal_properties', None)
00041     site_properties = getattr(portal_properties, 'site_properties', None)
00042     if site_properties.hasProperty('forbidden_contenttypes'):
00043         return list(site_properties.getProperty('forbidden_contenttypes'))
00044     else:
00045         return []

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.mimetype_utils.setDefaultContentType (   context,
  value 
)

Definition at line 12 of file mimetype_utils.py.

00012 
00013 def setDefaultContentType(context, value):
00014     portal_properties = getToolByName(context, 'portal_properties', None)
00015     site_properties = getattr(portal_properties, 'site_properties', None)
00016     site_properties.manage_changeProperties(default_contenttype=value)
        

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.mimetype_utils.setForbiddenContentTypes (   context,
  forbidden_contenttypes = [] 
)
Convenience method for settng the site property 'forbidden_contenttypes'.

Definition at line 31 of file mimetype_utils.py.

00031 
00032 def setForbiddenContentTypes(context, forbidden_contenttypes=[]):
00033     """ Convenience method for settng the site property 'forbidden_contenttypes'."""
00034     portal_properties = getToolByName(context, 'portal_properties', None)
00035     site_properties = getattr(portal_properties, 'site_properties', None)
00036     site_properties.manage_changeProperties(forbidden_contenttypes=tuple(forbidden_contenttypes))

Here is the call graph for this function:

Here is the caller graph for this function: