How Does Plone Choose a Skin?

by George Lee last modified Dec 30, 2008 03:05 PM
A description of the variables and processes that Plone uses to choose a skin each time you visit a page.

The current skin is determined every time you open a Zope or Plone web page on an object -- whether a page through the Zope Management Interface (ZMI) or in your Plone web site. Each time you do so, there are several key variables in play:

  • portal_skins, the skins tool.
  • object, the object you are accessing.
  • REQUEST, the HTTP request that is processed as you access the object and which expires when the page is rendered.
  • REQUEST.portal_skin. If this property exists on the REQUEST object, it says which skin to use. It is typically a cookie which is created when a user logs in, or when a user changes her/his preferences.
  • member.portal_skin. The standard way of creating a REQUEST.portal_skin cookie is by calling portal_skins.updateSkinCookie(). Provided that the current member has a 'portal_skin' property, this method creates a cookie portal_skin with a value equal to member.portal_skin.
  • SKINDATA, a variable tucked in the Python code of Products.CMFCore.Skinnable. During the life of a REQUEST, it stores information about what skin to use. The standard way of changing SKINDATA is a call of the form object.changeSkin('mySkin').


In the final stages of determining the skin, Plone takes three steps:

  • Look if a skin name is encoded in SKINDATA. If so, use it.
  • Otherwise, look if a skin name is stored in REQUEST.portal_skin. If so, use it.
  • Otherwise, look up the default skin in the portal_skins tool.