[Zope-dev] zope.publisher

Roger Ineichen dev at projekt01.ch
Wed Mar 4 21:01:29 EST 2009


Hi Martijn, Shane

I fixed some issues in zope.publisher and at the same
time I implemented the default skin pattern within 
an adapter pattern.

The adapter getDefaultSkin in zope.publisher.browser.py
is registered in configure.zcml

The changes are compatible within the zope core but only if 
zmcl is used.


The concept is the following
----------------------------

A request implementation can provide a named IDefaultSkin
adapter within the name "default". This default skin get
used if no other default skin get defined. The IDefaultBrowserLayer
is used as such a default adapter for IBrowserRequest.
This was done hardcoded in setDefaultSkin before my changes.

A default skin in your own projects get registered as
an unnamed IDefaultSkin adapter. This is normaly done
within the defaultSkin ZCML directive. Such a unnamed
adapter get used before the setDefaultSkin method will
lookup for the *fallback* named adapter.

Everything is 100% compatible if the adapter configuration
get used in configure.zcml.


Questions
---------

Everbody,
Right now the setDefaultSkin method will silently fail
if a skin doesn't provide ISkinType. What do you think
should we raise an exception instead of silently ignore 
the skin?

A general problem in the implemenation before and after my
changes is that the skin interfaces registered by the
defaultSkin ZCMl directive will register the interface
as adapter which is not adaptable because it's not an
adapter factory. Should we change the defaultSkin directive
and register an adapter factory? This whould ensure that we
don't have junk in the dapter registry.

Another question
The applySkin method removes all skin types from the
request. Why do we not remove all skin types in
setDefaultLayer? Are there any skins applied at the time
we call setDefaultSkin?

Martijn,
Does grok need to register this new adapter somewhere?
If the adapter configuration is missing the default skin
apply pattern will break.

Shane,
Can you review and merge this changes into your 
zope.pipeline branch?


Regards
Roger Ineichen
_____________________________
END OF MESSAGE



More information about the Zope-Dev mailing list