Changeset 3215 in products


Ignore:
Timestamp:
May 12, 2011 2:36:00 PM (9 years ago)
Author:
vmaksymiv
Message:

fixed layer uninstallation for plone<3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/Extensions/Install.py

    r3162 r3215  
    2323    profile = 'profile-quintagroup.plonecaptchas:uninstall' 
    2424    portal_setup.runAllImportStepsFromProfile(profile, purge_old=False) 
     25 
     26    # BBB: Remove skin layers. Need for plone < 3.1 
     27    skin_tool = getToolByName(self, 'portal_skins') 
     28    for skin in skin_tool.getSkinSelections(): 
     29        path = [elem for elem in skin_tool.getSkinPath(skin).split(',')] 
     30        for layer in ['captchas_discussion', 'captchas_sendto_form', 
     31                      'captchas_join_form']: 
     32            if layer in skin_tool.objectIds(): 
     33                skin_tool.manage_delObjects(ids=[layer]) 
     34            if layer in path: 
     35                path.remove(layer) 
     36        skin_path = ','.join(path) 
     37        skin_tool.addSkinSelection(skin, skin_path) 
    2538    transaction.savepoint() 
Note: See TracChangeset for help on using the changeset viewer.