EduploneWebdidactics/Extensions Install.py,NONE,1.1 __init__.py,NONE,1.1
Nils Haagen <[email protected]>
| Newsgroups | gmane.comp.web.zope.eduplone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/eduplone/EduploneWebdidactics/Extensions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26020/Extensions
Added Files:
Install.py __init__.py
Log Message:
--- NEW FILE: Install.py ---
"""\
$id$
This file is an installation script for this skin.
It is meant to be used as an External Method.
To use, either use Plone 2.0+ to install, or add an external
method to the root of the Plone Site that you want the skin registered
in with the configuration:
id: install_skin
title: Install Skin *optional*
module name: ExampleFileSystemSkin.Install
function name: install
Then go to the management screen for the newly added external method
and click the 'Try it' tab.
"""
from Products.CMFCore.TypesTool import ContentFactoryMetadata
from Products.CMFCore.DirectoryView import addDirectoryViews
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.CMFCorePermissions import ManagePortal
from cStringIO import StringIO
import string
from Products.EduploneWebdidactics import skin_globals
skin_names = ('EduploneWebdidactics',)
def setupSkin(self, out):
skinsTool = getToolByName(self, 'portal_skins')
# Add directory views
try:
addDirectoryViews(skinsTool, 'skins', skin_globals)
out.write( "Added directory views to portal_skins.\n" )
except:
out.write( '*** Unable to add directory views to portal_skins.\n')
# Go through the skin configurations and insert the skin
skins = skinsTool.getSkinSelections()
for skin in skins:
path = skinsTool.getSkinPath(skin)
path = map(string.strip, string.split(path,','))
changed = 0
for skin_name in skin_names:
if skin_name not in path:
try:
path.insert(path.index('custom')+1, skin_name)
changed = 1
except ValueError:
path.append(skin_name)
changed = 1
if changed:
path = string.join(path, ', ')
# addSkinSelection will replace existing skins as well.
skinsTool.addSkinSelection(skin, path)
out.write("Added %s to %s skin\n" % (', '.join(skin_names),skin))
else:
out.write("Skipping %s skin, %s already set up\n" % (skin, ', '.join(skin_names)))
def install(self):
out=StringIO()
setupSkin(self, out)
out.write('Installation completed.\n')
return out.getvalue()
--- NEW FILE: __init__.py ---
# this file is here to make Install.py importable.
# we need to make it non-zero size to make winzip cooperate
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND