[Zope3-dev] Use skin from ZMI

Albertas Agejevas alga at akl.lt
Thu Oct 14 06:38:32 EDT 2004


On Thu, Oct 14, 2004 at 01:06:15PM +0400, Florian Lindner wrote:
> One more question: Is is possbile to set a default skin?
> So I don't have to say: 
> http://localhost:8080/++skin++centershock/objname/ each time but just 
> http://localhost:8080/objname/?

If you want to use the skin just for a certain type of content
objects, subscribe to the BeforeTraverse event:

  from zope.app.publisher.browser import applySkin

  def myTraverseSubscriber(event):
      """A subscriber to BeforeTraverseEvent

      Sets the MySkin skin if the object traversed is MyContent.
      """
      if IMyContent.providedBy(event.object):
	  applySkin(event.request, MySkin)


  <subscriber
      factory=".skin.myTraverseSubscriber"
      for="zope.app.publication.interfaces.IBeforeTraverseEvent"
      />

If you want to set a default skin for the whole Zope 3 instance, just
use the browser:defaultSkin directive in overrides.zcml.

Cheers,
Albert


More information about the Zope3-dev mailing list