[Zope-PTK] How skins work

Shane Hathaway shane@digicool.com
Wed, 17 Jan 2001 18:44:51 -0500


Nolan Darilek wrote:
> I'm curious to know
> how, though. If all of the DemoPortal content is removed to the
> filesystem, how exactly are existing methods editted? Is the data
> copied from the filesystem and into the ZODB, with edits only occuring
> in the database? Or are the methods' files editted on the filesystem
> itself? Currently I have directories in the zope products directory
> symlinked to the CVS tree, so upgrading the PTK is usually a matter of
> updating CVS, restarting zope and re-importing the PTK demo. How does
> the introduction of skins change this process? Will new dtml methods
> be read in from the filesystem when changed, or will I need to click a
> "refresh" button to manually upgrade the methods?

Let me see if I can provide a few concepts that will clarify how this
works.

portal_skins is a folder containing DTML loaded both from the filesystem
and from the ZODB.
  
The portal object knows about the portal_skins tool and grabs objects
from it in a manner very similar to transparent folders.  If you search
the portal object for an object called "index_html", for example, and
it's not found in the normal place, portal_skins will be searched
transparently.

Users are able to select "skin paths".  Skin paths refer to hierarchies
inside the portal_skins folder.  If your portal_skins folder has the
folders "generic" and "control" in it, valid skin paths include
"generic/" and "control/" as well as paths that use acquisition tricks
like "generic/control/" and "control/generic/".

You can use acquisition tricks to set up skin paths, meaning that you
can set up a search path that includes DTML from the filesystem as well
as from the ZODB.

So a common skin path will be "control/generic/custom" where "custom" is
the name of a normal ZODB Folder in portal_skins.  When users use that
skin path, anything in "custom" will override the objects in control or
generic.

Set up this way, all you have to do to upgrade your PTK is update the
filesystem products.  Your customizations, safe in the ZODB, will be
retained.

There is a button provided on DTML methods loaded from the filesystem
that lets you copy to a custom folder.  That way you can have the
security of read-only access while making it easy to customize.

However, I think a lot of people will opt to use LocalFS instead of
DirectoryViews to set up skins.  That way you can have the benefit of
CVS diffing and merging.  I haven't checked, but it should be fully
compatible.  You just add a LocalFS instance to a portal_skins folder
and set up skin paths that point into the LocalFS instance.

I've already set it up on my box and it's quite nice if I may say so.
:-)  There are a few more integration tasks to complete, but we're not
far now.

Shane