[Zope-dev] Default skin pain

2006-03-18 Thread Philipp von Weitershausen
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
layer.

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
ZPublisher.Publish.publish_module_standard.

(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)

Philipp

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


Re: [Zope-dev] Default skin pain

2006-03-18 Thread Lennart Regebro
On 3/18/06, Philipp von Weitershausen [EMAIL PROTECTED] wrote:
 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
 ZPublisher.Publish.publish_module_standard.

That's probably a good idea.

Althoug, wasn't somebody going to try replacing the whole publisher?

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Default skin pain

2006-03-18 Thread Philipp von Weitershausen
Lennart Regebro wrote:
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
ZPublisher.Publish.publish_module_standard.
 
 That's probably a good idea.
 
 Althoug, wasn't somebody going to try replacing the whole publisher?

Sure. We just can't wait for that. I consider this a bugfix so it'll go
into Zope 2.9 as well as the trunk.

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


Re: [Zope-dev] Default skin pain

2006-03-18 Thread Lennart Regebro
On 3/18/06, Philipp von Weitershausen [EMAIL PROTECTED] wrote:
 Sure. We just can't wait for that. I consider this a bugfix so it'll go
 into Zope 2.9 as well as the trunk.

Oh, well in that case... +1.

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )