[CMF-checkins] CVS: CMF - addImagesToSkinPaths.pys:1.1
Martijn Pieters
mj@digiciool.com
Tue, 13 Mar 2001 17:25:54 -0500 (EST)
Update of /cvs-repository/CMF/CMFDefault/scripts
In directory korak:/tmp/cvs-serv6198/scripts
Added Files:
addImagesToSkinPaths.pys
Log Message:
Fix for PTK(205)[]; remove all direct references to the skins' Images
Folder, promoting it to a regular skin path object.
Existing CMF 1.0b1 portals will have to add 'Images' to their skin paths; a
Python Script that automates this is included.
--- Added File addImagesToSkinPaths.pys in package CMF ---
## Script (Python) "addImagesToSkinPaths"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Add the name 'Images' to all skin paths.
##
# The Folder 'Images' in portal_skins is no longer directly referenced,
# and should now be part of all skin paths. This script adds 'Images' to
# all skins defined in the portal.
#
# Use this by creating a PythonScript object by the name
# 'addImagesToSkinPaths' in your Portal, with this file as initial
# content. Run it by selecting the 'Test' tab. You will need to have the
# 'Manage portal' permission in order to be able to execute this method.
import string
ps = context.portal_skins
skins = ps.getSkinSelections()
for skin in skins:
path = ps.getSkinPath(skin)
path = string.split(path, ',')
path = map(string.strip, path)
if 'Images' not in path:
path.append('Images')
path = string.join(path, ', ')
# addSkinSelection will replace existing skins as well.
ps.addSkinSelection(skin, path)
print "Added 'Images' folder to %s skin." % `skin`
else:
print "Skipping %s skin, already has 'Images' in it's path." % `skin`
return printed