Wezzul.com - It's the Dinglez

Working with Skins in Plone - Wezzul.com

Working with Skins in Plone

This one took me a minute to figure out, but I'm happy I did. To create a new skin from the filesystem, and add your own layers to it (or in this case, add the layers from Plone Default), do the following:

#use this to get the skins directory
ps = getToolByName(self,'portal_skins')

# use this to add a new folder to that directory for your new skin
ps.manage_addFolder(skin_id, skin_id)

newSkinFolder = getattr(ps, skin_id)
path = newSkinFolder.absolute_url()

# get a set of tuples of all skins
paths = ps.getSkinPaths()

# these lines get the layers from Plone Default
defPath = paths[0]
defPath = defPath[1]

# add your new folder to the top of the Plone Default layers
defPath = skin_id "," defPath

# add the skin to the properties of portal_skins
ps.addSkinSelection(skin_id, defPath, 0, 0)


Pretty straight forward, right? In any case, it is helping me immensely with the current project.

Posted on Thursday, February 01, 8:59am in Tech by wezzul
Username:

URL:

Comment: