Changeset 1785 in products


Ignore:
Timestamp:
Feb 19, 2010 11:08:34 AM (14 years ago)
Author:
liebster
Message:

Added reinstall method: migrate actions from portal_types to portal_actions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/setuphandlers.py

    r1570 r1785  
    66 
    77def migrationActions(site): 
    8     old = 'qseo_properties_edit_form' 
    9     new = '@@seo-context-properties' 
    10     condition = "python:exists('portal/@@seo-context-properties')" 
     8    p_props = getToolByName(site, 'portal_properties') 
     9    seo_props = getToolByName(p_props, 'seo_properties') 
     10    ctws = list(seo_props.getProperty('content_types_with_seoproperties', [])) 
     11 
    1112    for ptype in site.portal_types.objectValues(): 
    12         acts = filter(lambda x: x.id == 'seo_properties' , ptype.listActions()) 
    13         for act in acts: 
    14             log = 0 
    15             if not act.condition: 
    16                 act.condition = Expression(condition) 
    17                 log = 1 
    18             ac_exp = act.getActionExpression() 
    19             if old in ac_exp: 
    20                 act.setActionExpression(ac_exp.replace(old, new)) 
    21                 log = 1 
    22             if log: 
    23                 logger.log(logging.INFO, "Updated \"SEO Properties\" action in %s type." % ptype.id) 
     13        for idx, act in enumerate(ptype.listActions()): 
     14            if act.id == 'seo_properties': 
     15                if  ptype.id not in ctws: 
     16                    ctws.append(ptype.id) 
     17                ptype.deleteActions([idx]) 
     18                logger.log(logging.INFO, "Moved \"SEO Properties\" action from %s type in portal actions." % ptype.id) 
     19    seo_props.manage_changeProperties(content_types_with_seoproperties=ctws) 
    2420 
    2521def removeSkin(self, layer): 
Note: See TracChangeset for help on using the changeset viewer.