Back to index

plone3  3.1.7
Functions
CMFPlone.migrations.v2_5.final_two51 Namespace Reference

Functions

def final_two51
def removePloneCssFromRR
def addEventRegistrationJS
def fixupPloneLexicon
def fixObjDeleteAction

Function Documentation

Add event-registration.js to ResourceRegistries.

Definition at line 53 of file final_two51.py.

00053 
00054 def addEventRegistrationJS(portal, out):
00055     """Add event-registration.js to ResourceRegistries.
00056     """
00057     jsreg = getToolByName(portal, 'portal_javascripts', None)
00058     script = 'event-registration.js'
00059     if jsreg is not None:
00060         script_ids = jsreg.getResourceIds()
00061         # Failsafe: first make sure the stylesheet doesn't exist in the list
00062         if script not in script_ids:
00063             jsreg.registerScript(script)
00064             # put it at the top of the stack
00065             jsreg.moveResourceToTop(script)
00066             out.append("Added " + script + " to portal_javascipt")
00067 

Here is the call graph for this function:

Here is the caller graph for this function:

2.5-final -> 2.5.1

Definition at line 10 of file final_two51.py.

00010 
00011 def final_two51(portal):
00012     """2.5-final -> 2.5.1
00013     """
00014     out = []
00015 
00016     # Make the portal a Zope3 site
00017     enableZope3Site(portal, out)
00018 
00019     # register some tools as utilities
00020     registerToolsAsUtilities(portal, out)
00021 
00022     removePloneCssFromRR(portal, out)
00023 
00024     # add event_registration.js
00025     addEventRegistrationJS(portal, out)
00026 
00027     # Repair plone_lexicon pipeline
00028     fixupPloneLexicon(portal, out)
00029 
00030     # We need to migrate all existing actions to new-style actions first
00031     migrateOldActions(portal, out)
00032     # Make object delete action use confirmation form
00033     fixObjDeleteAction(portal, out)
00034 
00035     # Required for #5569 (is_folderish needs reindexing) and #5231 (all text
00036     # indices need to be reindexed so they are split properly)
00037     migtool = getToolByName(portal, 'portal_migration')
00038     migtool._needRecatalog = True
00039 
00040     return out
00041 

Here is the call graph for this function:

Make the delete action use the new confirmation form

Definition at line 93 of file final_two51.py.

00093 
00094 def fixObjDeleteAction(portal, out):
00095     """Make the delete action use the new confirmation form
00096     """
00097     delete = Action('delete',
00098         title='Delete',
00099         i18n_domain='plone',
00100         url_expr='string:${globals_view/getCurrentObjectUrl}/delete_confirmation',
00101         available_expr='python:checkPermission("Delete objects", globals_view.getParentObject()) and not globals_view.isPortalOrPortalDefaultPage()',
00102         permissions=(DeleteObjects,),
00103         visible=True)
00104 
00105     actionsTool = getToolByName(portal, 'portal_actions', None)
00106     if actionsTool is not None:
00107         category = actionsTool.object_buttons
00108         for action in category.objectIds():
00109             # if action exists, remove and re-add
00110             if action == 'delete':
00111                 category._delObject('delete')
00112                 break
00113 
00114         category['delete'] = delete
00115         category.moveObjectsToBottom(('delete',))
00116         category.moveObjectsUp(('delete',))
00117         out.append("Added/modified delete object_buttons action.")

Here is the call graph for this function:

Here is the caller graph for this function:

Updates the plone_lexicon pipeline with the new splitter
   and case normalizer.

Definition at line 68 of file final_two51.py.

00068 
00069 def fixupPloneLexicon(portal, out):
00070     """Updates the plone_lexicon pipeline with the new splitter
00071        and case normalizer.
00072     """
00073     catalog = getToolByName(portal, 'portal_catalog', None)
00074     if catalog is not None:
00075         if 'plone_lexicon' in catalog.objectIds():
00076             lexicon = catalog.plone_lexicon
00077             pipeline = list(lexicon._pipeline)
00078             if len(pipeline) >= 2:
00079                 if (not isinstance(pipeline[0], Splitter) or
00080                     not isinstance(pipeline[1], CaseNormalizer)):
00081                     pipeline[0] = Splitter()
00082                     pipeline[1] = CaseNormalizer()
00083                     lexicon._pipeline = tuple(pipeline)
00084                     # Clear the lexicon
00085                     from BTrees.OIBTree import OIBTree
00086                     from BTrees.IOBTree import IOBTree
00087                     from BTrees.Length import Length
00088                     lexicon._wids = OIBTree()
00089                     lexicon._words = IOBTree()
00090                     lexicon.length = Length()
00091                     out.append('Updated plone_lexicon pipeline.')
00092 

Here is the call graph for this function:

Here is the caller graph for this function:

Removes the redundant, deprecated, and failing plone.css from portal_css.
   It is a python script now and just calls portal_css itself.

Definition at line 42 of file final_two51.py.

00042 
00043 def removePloneCssFromRR(portal, out):
00044     """Removes the redundant, deprecated, and failing plone.css from portal_css.
00045        It is a python script now and just calls portal_css itself."""
00046     css_reg = getToolByName(portal, 'portal_css', None)
00047     if css_reg is not None:
00048         stylesheet_ids = css_reg.getResourceIds()
00049         if 'plone.css' in stylesheet_ids:
00050             css_reg.unregisterResource('plone.css')
00051             out.append('Unregistered deprecated plone.css')
00052 

Here is the call graph for this function:

Here is the caller graph for this function: