Back to index

plone3  3.1.7
Functions
PortalTransforms.setuphandlers Namespace Reference

Functions

def correctMapping
def updateSafeHtml
def installPortalTransforms
def setupPortalTransforms

Detailed Description

PortalTransforms setup handlers.

Function Documentation

def PortalTransforms.setuphandlers.correctMapping (   out,
  portal 
)

Definition at line 9 of file setuphandlers.py.

00009 
00010 def correctMapping(out, portal):
00011     pt = getToolByName(portal, 'portal_transforms')
00012     pt_ids = pt.objectIds()
00013 
00014     for m_in, m_out_dict in pt._mtmap.items():
00015         for m_out, transforms in m_out_dict.items():
00016             for transform in transforms:
00017                 if transform.id not in pt_ids:
00018                     #error, mapped transform is no object in portal_transforms. correct it!
00019                     print >>out, "have to unmap transform (%s) cause its not in portal_transforms ..." % transform.id
00020                     try:
00021                         pt._unmapTransform(transform)
00022                     except:
00023                         raise
00024                     else:
00025                         print >>out, "...ok"

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 49 of file setuphandlers.py.

00049 
00050 def installPortalTransforms(portal):
00051     out = StringIO()
00052 
00053     updateSafeHtml(out, portal)
00054 
00055     correctMapping(out, portal)

Here is the call graph for this function:

Here is the caller graph for this function:

Setup PortalTransforms step.

Definition at line 56 of file setuphandlers.py.

00056 
00057 def setupPortalTransforms(context):
00058     """
00059     Setup PortalTransforms step.
00060     """
00061     # Only run step if a flag file is present (e.g. not an extension profile)
00062     if context.readDataFile('portal-transforms-various.txt') is None:
00063         return
00064     out = []
00065     site = context.getSite()
00066     installPortalTransforms(site)
00067 

Here is the call graph for this function:

def PortalTransforms.setuphandlers.updateSafeHtml (   out,
  portal 
)

Definition at line 26 of file setuphandlers.py.

00026 
00027 def updateSafeHtml(out, portal):
00028     print >>out, 'Update safe_html...'
00029     safe_html_id = 'safe_html'
00030     safe_html_module = "Products.PortalTransforms.transforms.safe_html"
00031     pt = getToolByName(portal, 'portal_transforms')
00032     for id in pt.objectIds():
00033         transform = getattr(pt, id)
00034         if transform.id == safe_html_id and transform.module == safe_html_module:
00035             try:
00036                 disable_transform = transform.get_parameter_value('disable_transform')
00037             except KeyError:
00038                 print >>out, '  replace safe_html (%s, %s) ...' % (transform.name(), transform.module)
00039                 try:
00040                     pt.unregisterTransform(id)
00041                     pt.manage_addTransform(id, safe_html_module)
00042                 except:
00043                     raise
00044                 else:
00045                     print >>out, '  ...done'
00046     
00047     print >>out, '...done'
00048 

Here is the call graph for this function:

Here is the caller graph for this function: