[Zope3-dev] Re: Last chance to comment on Simplify skinning

Philipp von Weitershausen philipp at weitershausen.de
Wed Feb 15 07:49:14 EST 2006

Dear Tonico,

thanks for your input.

> In CMF things are very easy to understand, because a layer is simply a
> folder. I can explain that in five minutes to a template programmer.

Why does the template programmer need to know about layers?

> Maybe this sounds a bit NAIVE, but would it be possible to make it like
> in CMF?

The CMF approach is very limiting. The fact that a layer equals a
physical location (a folder) led to every CMF-based product coming up
with its own layer -- because there is no way to put stuff into existing
layers, not even the default layer. Layers as they are in Zope 3 have
stopped this senseless layer proliferation.

I find Zope 3's approach much simpler and much easier to explain than
the CMF's approach. In Zope 3 (especially with my proposed changes in
place), a layer is simply a label (read: marker interface) on the
request. When we now look up pages and resources (e.g. images), we take
the request into account and therefore inevitably that label. We will
only find pages and resources associated (read: registered) for this
label. Good news is that any page or resource can be associated for this
label, we just have to remember to do that in their ZCML directive.

See, now I even explained this to a "template programmer", though I
don't think he'd care.

> Use case: Integrate an existing application into my Web site, e.g. a forum.
> 1. Create a folder for the customized forum skin
> $ mkdir forum-skin
> 2. Register this folder
> <blah:skin-folder
>     path="forum-skin"
>     ...
>     />
> 3. Customize everything from original forum skin
> $ cd forum-skin
> $ cp $ORIGINAL_FORUM_SKIN/*.pt .
> $ vi *
> This is oversimplified, I know :)

Yes. It's also limiting.

> Another note: when I see this I feel a cold shudder:
> <browser:resource
>     name="zope3logo.gif"
>     file="shanghailogo.gif"
>     type=".interfaces.ShanghaiSkin"
>     />
> Quite a lot of typing for one GIF!?

Registering resources explicitly gives us the ability to easily override
resources. That'll allow us to change logos, icons, etc. with just one
ZCML directive. In fact, the ability to override is *the* foremost use
case for registering stuff explicitly at all.

If you want to save typing, you can have resource directories where you
dump anything you want to be available as a resource.


More information about the Zope3-dev mailing list