Hi there,

Zope 3 has the concept of a default layer. This is a request interface
that most skins derive from. It is also the default request interface
that browser views are registered for if they don't specify another one
using the 'layer' argument.

Zope 3 also has the concept of a default skin. This is a request
interface that is specially registered and applied to the request after
it has been created. This last bit is important because you want all
subsequent view look-ups to take the default skin into account. Since
most browser views are registered for the default layer interface and
most skins derive from the default layer interface, not setting the
default skin on the request as early as possible would result in most
views not being found.

Of course, ZPublisher doesn't apply the default skin to the request
after its creation. Therefore, Five has to do a hack: upon the first
Five-style traversal (that might involve Zope 3 views), it puts the
default skin on the request. There are two problems with this approach:

* Previous traversal steps could have already set a different layer (or
skin) on the request. This is a valid usecase (e.g. ++skin++ can be used
for this). Five's behaviour would possibly make the previously applied
layers or skins ineffective again. Five tries to be as uninvasive as
possible by only doing this when the request doesn't have an ILayer
interface yet. Problem is, the notion of all layer interfaces providing
ILayer is going to go away (it's already deprecated on the Zope 3 trunk).

* More importantly, you sometimes might want to do view lookup before
the first Five-style traversal happens. Then you're dealing with a
virgin request that doesn't have the default skin installed (and
therefore neither the default layer in most case) and your view look-ups
 would probably fail because the views were registered for the default

The latter point is an issue in Plone, by the way.

I would propose to remove the Five hack and "properly" set the default
skin right after the request has been created. This would be in

(ZopeTestCase would also have to be fixed up so that each test gets its
individual request object [all tests currently share the same one!] and
that the request would also have the default skin set from the beginning)


Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to