Back to index

plone3  3.1.7
Functions
CMFPlone.migrations.v2_1.two12_two13 Namespace Reference

Functions

def two12_two13
def normalizeNavtreeProperties
def removeVcXMLRPC
def addActionDropDownMenuIcons
def reindexCatalog
def indexMembersFolder

Function Documentation

Add icons for copy, cut, paste and delete

Definition at line 71 of file two12_two13.py.

00071 
00072 def addActionDropDownMenuIcons(portal, out):
00073     """Add icons for copy, cut, paste and delete
00074     """
00075     ai=getToolByName(portal, 'portal_actionicons', None)
00076     if ai is None:
00077         return
00078     icons = dict([
00079         ((x.getCategory(), x.getActionId()), x)
00080         for x in ai.listActionIcons()
00081     ])
00082     added = False
00083     if ('object_buttons', 'cut') not in icons:
00084         ai.addActionIcon('object_buttons', 'cut', 'cut_icon.gif', 'Cut')
00085         added = True
00086     else:
00087         ai.updateActionIcon('object_buttons', 'cut', 'cut_icon.gif', 'Cut')
00088     if ('object_buttons', 'copy') not in icons:
00089         ai.addActionIcon('object_buttons', 'copy', 'copy_icon.gif', 'Copy')
00090         added = True
00091     else:
00092         ai.updateActionIcon('object_buttons', 'copy', 'copy_icon.gif', 'Copy')
00093     if ('object_buttons', 'paste') not in icons:
00094         ai.addActionIcon('object_buttons', 'paste', 'paste_icon.gif', 'Paste')
00095         added = True
00096     else:
00097         ai.updateActionIcon('object_buttons', 'paste', 'paste_icon.gif', 'Paste')
00098     if ('object_buttons', 'delete') not in icons:
00099         ai.addActionIcon('object_buttons', 'delete', 'delete_icon.gif', 'Delete')
00100         added = True
00101     else:
00102         ai.updateActionIcon('object_buttons', 'delete', 'delete_icon.gif', 'Delete')
00103     if added:
00104         out.append('Added icons for copy, cut, paste and delete')
00105     else:
00106         out.append('Updated icons for copy, cut, paste and delete')
00107 

Here is the call graph for this function:

Here is the caller graph for this function:

Makes sure the Members folder is cataloged.

Definition at line 123 of file two12_two13.py.

00123 
00124 def indexMembersFolder(portal, out):
00125     """Makes sure the Members folder is cataloged."""
00126     catalog = getToolByName(portal, 'portal_catalog', None)
00127     if catalog is not None:
00128         membershipTool = getToolByName(portal, 'portal_membership', None)
00129         if membershipTool is not None:
00130             members = membershipTool.getMembersFolder()
00131             if members is not None:
00132                 members.indexObject()
00133                 out.append('Recataloged Members folder.')
00134 

Here is the call graph for this function:

Remove unused navtree properties, add 'name' and 'root' properties. Set
bottomLevel to 0 if it's 65535 (the old marker)

Definition at line 34 of file two12_two13.py.

00034 
00035 def normalizeNavtreeProperties(portal, out):
00036     """Remove unused navtree properties, add 'name' and 'root' properties. Set
00037     bottomLevel to 0 if it's 65535 (the old marker)
00038     """
00039     toRemove = ['skipIndex_html', 'showMyUserFolderOnly', 'showFolderishSiblingsOnly',
00040                 'showFolderishChildrenOnly', 'showNonFolderishObject', 'showTopicResults',
00041                 'rolesSeeContentView', 'rolesSeeUnpublishedContent', 'rolesSeeContentsView', 
00042                 'batchSize', 'sortCriteria', 'croppingLength', 'forceParentsInBatch', 
00043                 'rolesSeeHiddenContent', 'typesLinkToFolderContents']
00044     toAdd = {'name' : ('string', ''), 
00045              'root' : ('string', '/'), 
00046              'currentFolderOnlyInNavtree' : ('boolean', False)}
00047     portal_properties = getToolByName(portal, 'portal_properties', None)
00048     if portal_properties is not None:
00049         navtree_properties = getattr(portal_properties, 'navtree_properties', None)
00050         if navtree_properties is not None:
00051             for property in toRemove:
00052                 if navtree_properties.getProperty(property, None) is not None:
00053                     navtree_properties._delProperty(property)
00054             for property, value in toAdd.items():
00055                 if navtree_properties.getProperty(property, None) is None:
00056                     navtree_properties._setProperty(property, value[1], value[0])
00057             bottomLevel = navtree_properties.getProperty('bottomLevel', None)
00058             if bottomLevel == 65535:
00059                 navtree_properties.manage_changeProperties(bottomLevel = 0)
00060 

Here is the call graph for this function:

Here is the caller graph for this function:

Rebuilds the portal_catalog.

Definition at line 108 of file two12_two13.py.

00108 
00109 def reindexCatalog(portal, out):
00110     """Rebuilds the portal_catalog."""
00111     catalog = getToolByName(portal, 'portal_catalog', None)
00112     if catalog is not None:
00113         # Reduce threshold for the reindex run
00114         old_threshold = catalog.threshold
00115         pg_threshold = getattr(catalog, 'pgthreshold', 0)
00116         catalog.pgthreshold = 300
00117         catalog.threshold = 2000
00118         catalog.refreshCatalog(clear=1)
00119         catalog.threshold = old_threshold
00120         catalog.pgthreshold = pg_threshold
00121         out.append("Reindexed portal_catalog.")
00122 

Here is the call graph for this function:

Remove vcXMLRPC.js from ResourceRegistries

Definition at line 61 of file two12_two13.py.

00061 
00062 def removeVcXMLRPC(portal, out):
00063     """Remove vcXMLRPC.js from ResourceRegistries
00064     """
00065     jsreg = getToolByName(portal, 'portal_javascripts', None)
00066     if jsreg is not None:
00067         if 'vcXMLRPC.js' in jsreg.getResourceIds():
00068             jsreg.unregisterResource('vcXMLRPC.js')
00069             out.append('Removed vcXMLRPC.js')
00070 

Here is the call graph for this function:

Here is the caller graph for this function:

2.1.2 -> 2.1.3

Definition at line 7 of file two12_two13.py.

00007 
00008 def two12_two13(portal):
00009     """2.1.2 -> 2.1.3
00010     """
00011     out = []
00012 
00013     # Make the portal a Zope3 site
00014     enableZope3Site(portal, out)
00015 
00016     # register some tools as utilities
00017     registerToolsAsUtilities(portal, out)
00018 
00019     # Put navtree properties in a sensible state
00020     normalizeNavtreeProperties(portal, out)
00021 
00022     # Remove vcXMLRPC.js from ResourceRegistries
00023     removeVcXMLRPC(portal, out)
00024 
00025     # Required due to a fix in PortalTransforms...
00026     migtool = getToolByName(portal, 'portal_migration')
00027     migtool._needRecatalog = True
00028 
00029     # add icons for copy, cut, paste and delete
00030     addActionDropDownMenuIcons(portal, out)
00031 
00032     return out
00033 

Here is the call graph for this function: