Changeset 1096
- Timestamp:
- 03/24/08 11:47:06
- Files:
-
- qPloneSkinDump/branches/plone_3.0/skin_template/Extensions (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/Extensions/Install.py (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/Extensions/__init__.py (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/HISTORY.txt (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/VERSION.txt (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/config.py (modified) (1 diff)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles.zcml (modified) (1 diff)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles/afterinstall (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles/afterinstall/import_steps.xml (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles/default/import_steps.xml (deleted)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles/default/propertiestool.xml (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles/uninstall/import_steps.xml (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/profiles/uninstall/skins.xml (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/setuphandlers.py (modified) (7 diffs)
- qPloneSkinDump/branches/plone_3.0/skin_template/uninstallhandlers.py (added)
- qPloneSkinDump/branches/plone_3.0/skin_template/utilsPortlets.py (added)
- qPloneSkinDump/branches/plone_3.0/utils.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneSkinDump/branches/plone_3.0/skin_template/config.py
r999 r1096 111 111 from Globals import package_home 112 112 PRODUCTS_PATH = os.sep.join(package_home(GLOBALS).split(os.sep)[:-1]) 113 114 ## GenericSetup constants 115 GS_INSTALL_PROFILE = "profile-Products.%(product_name)s:default" 116 GS_AFTERINSTALL_PROFILE = "profile-Products.%(product_name)s:afterinstall" 117 GS_UNINSTALL_PROFILE = "profile-Products.%(product_name)s:uninstall" qPloneSkinDump/branches/plone_3.0/skin_template/profiles.zcml
r935 r1096 12 12 /> 13 13 14 <genericsetup:registerProfile 15 name="afterinstall" 16 title="%(product_name)s:afterinstall" 17 directory="profiles/afterinstall" 18 description="Extension profile for install zexps and other dependent objects of %(product_name)s." 19 provides="Products.GenericSetup.interfaces.EXTENSION" 20 /> 21 22 <genericsetup:registerProfile 23 name="uninstall" 24 title="%(product_name)s:uninstall" 25 directory="profiles/uninstall" 26 description="Extension profile for UNINSTALL %(product_name)s." 27 provides="Products.GenericSetup.interfaces.EXTENSION" 28 /> 29 14 30 </configure> qPloneSkinDump/branches/plone_3.0/skin_template/setuphandlers.py
r1010 r1096 1 import sys 2 from logging import getLogger 3 4 from BTrees.OOBTree import OOBTree 5 from persistent.list import PersistentList 6 1 7 from zope.dottedname.resolve import resolve 2 8 from zope.component import getUtility, getSiteManager, getMultiAdapter … … 15 21 from Products.%(product_name)s.config import * 16 22 from Products.%(product_name)s.utils import * 23 from Products.%(product_name)s.utilsPortlets import dumpPortlets 17 24 18 import sys19 from logging import getLogger20 25 logger = getLogger('%(product_name)s') 21 26 … … 56 61 manager = managers.get(name, None) 57 62 if manager is not None: 63 # set portlet assignments 64 mapping = getMultiAdapter((context, manager), IPortletAssignmentMapping, context=context) 65 66 # purge mapping 67 mapping._data = OOBTree() 68 mapping._order = PersistentList() 69 58 70 if info['assignments']: 59 71 # set portlet assignments 60 mapping = getMultiAdapter((context, manager), IPortletAssignmentMapping, context=context)61 72 for assignment in info['assignments']: 62 73 assignPortlet(mapping, assignment) … … 67 78 localassignmentmanager.setBlacklistStatus(category, status) 68 79 80 81 def saveBeforeInstallPortlets(context): 82 # Save information about portlets before installation 83 84 beforeInstall = dumpPortlets(context=context, dump_policy='root', dump_portlets_selection=[] ) 85 86 # update properties list 87 pp = getToolByName(context, 'portal_properties') 88 skin_props = pp._getOb('%(product_name_lowercase)s_properties') 89 skin_props._updateProperty('portlets_before_install', str(beforeInstall) ) 90 91 69 92 def importPortlets(context): 93 94 if context.readDataFile("%(afterinstall_profile_marker)s") is None: 95 return 96 70 97 site = context.getSite() 98 99 saveBeforeInstallPortlets(site) 71 100 72 101 components = getSiteManager(site) … … 94 123 95 124 def importZexps(context): 125 126 if context.readDataFile("%(afterinstall_profile_marker)s") is None: 127 return 128 96 129 site = context.getSite() 97 130 if checkIfImport(): … … 99 132 100 133 def importVarious(context): 134 135 if context.readDataFile("%(afterinstall_profile_marker)s") is None: 136 return 137 101 138 site = context.getSite() 102 139 out = StringIO() … … 105 142 106 143 def importCustomViews(context): 144 145 if context.readDataFile("%(afterinstall_profile_marker)s") is None: 146 return 147 107 148 site = context.getSite() 108 149 qPloneSkinDump/branches/plone_3.0/utils.py
r1026 r1096 346 346 copyDir(src_path, dst_path, productName) 347 347 348 def fsDirectoryViewsXML(folder_names, product_name ):348 def fsDirectoryViewsXML(folder_names, product_name, remove=False): 349 349 pattern = """ <object name="%(folder_name)s" meta_type="Filesystem Directory View" 350 directory="Products.%(product_name)s:skins/%(folder_name)s" />\n"""350 directory="Products.%(product_name)s:skins/%(folder_name)s" %(remove)s/>\n""" 351 351 xml = '' 352 352 if type(folder_names) not in (type([]), type(())): 353 353 folder_names = [folder_names,] 354 354 for name in folder_names: 355 xml += pattern % {'product_name' : product_name, 'folder_name' : name} 355 xml += pattern % {'product_name' : product_name, \ 356 'folder_name' : name, \ 357 'remove' : remove and 'remove="True"' or '', \ 358 } 356 359 return xml 357 360 … … 368 371 os.mkdir(productPath) 369 372 files_to_remove = [] 373 files_to_add = [] 370 374 # Form CSS and JS importing list and regestry data (looking in subdir too) for Plone 2.1.0+ 371 375 stylesheets_xml = '' … … 405 409 # Prepare XML strings for add to skins.xml 406 410 skin_layers = buildSkinLayers(context, zmi_base_skin_name) 411 412 # Prepare profiles 413 default_marker, afterinstall_marker, uninstall_marker = {}, {}, {} 414 profiles = ['default', 'afterinstall', 'uninstall'] 415 profiles_path = ospJoin(products_path, productName, 'profiles') 416 for profile in profiles: 417 varname = "%s_marker" % profile 418 file_name = "%s_%s.txt" % (productName.lower(), profile) 419 locals()[varname].update({'fname' : file_name, \ 420 'fpath' : ospJoin(profiles_path, profile, file_name), \ 421 'fdata' : "# Marker file for %s profile of %s skin" % \ 422 (profile, productName) }) 423 files_to_add.append(locals()[varname]) 407 424 408 425 # dump customized objects from portal_view_customization … … 442 459 ,"skin_layers" : skin_layers \ 443 460 ,"custom_views" : str(custom_views) \ 444 ,"directory_views_xml" : fsDirectoryViewsXML(zmi_skin_names, productName)} 461 ,"directory_views_xml" : fsDirectoryViewsXML(zmi_skin_names, productName) \ 462 ,"remove_directory_views_xml" : fsDirectoryViewsXML(zmi_skin_names, productName, remove=True) \ 463 ,"creation_date" : time.strftime('%d/%m/%Y') \ 464 ,"install_profile_marker" : default_marker['fname'] \ 465 ,"afterinstall_profile_marker" : afterinstall_marker['fname'] \ 466 ,"uninstall_profile_marker" : uninstall_marker['fname'] \ 467 } 445 468 sp_updated_files = ['config.py' \ 446 469 ,'README.txt' \ 470 ,'HISTORY.txt' \ 447 471 ,'setuphandlers.py' \ 472 ,'uninstallhandlers.py' \ 448 473 ,'profiles.zcml' \ 449 474 ,'utils.py' \ 450 475 ,'configure.zcml' \ 451 476 ,'skins.zcml' \ 477 ,ospJoin('Extensions', 'Install.py')\ 452 478 ,ospJoin('browser', 'interfaces.py')\ 453 479 ,ospJoin('browser', 'viewlets.zcml')\ 454 480 ,ospJoin('browser', 'configure.zcml')\ 455 ,ospJoin('profiles', 'default', 'import_steps.xml')\456 481 ,ospJoin('profiles', 'default', 'skins.xml')\ 457 482 ,ospJoin('profiles', 'default', 'cssregistry.xml')\ 458 483 ,ospJoin('profiles', 'default', 'jsregistry.xml')\ 459 ,ospJoin('browser', 'configure.zcml') 484 ,ospJoin('profiles', 'default', 'propertiestool.xml')\ 485 ,ospJoin('profiles', 'afterinstall', 'import_steps.xml')\ 486 ,ospJoin('profiles', 'uninstall', 'import_steps.xml')\ 487 ,ospJoin('profiles', 'uninstall', 'skins.xml')\ 488 ,ospJoin('browser', 'configure.zcml') \ 489 #,ospJoin('profiles', 'uninstall', 'cssregistry.xml')\ 490 #,ospJoin('profiles', 'uninstall', 'jsregistry.xml')\ 460 491 ] 461 492 for fp in sp_updated_files: … … 463 494 for fp in files_to_remove: 464 495 os.remove(ospJoin(productPath,fp)) 496 for data in files_to_add: 497 f = file(data['fpath'],'w') 498 f.write(data['fdata']) 499 f.close()
