[z3-five] Question about skins usage
Maciej Wiśniowski
maciej.wisniowski at coig.katowice.pl
Wed Jul 26 13:52:47 CEST 2006
>Shrug! Don't mess with the traversal name stack. Simply use
>IMySkin.providedBy(request) for checking whether the request has your
>skin and zope.app.publisher.browser.applySkin(request, IMySkin) for
>applying the skin to the request.
>
>
It took me some time to find out how to define skins as interfaces etc. but
finally I did this and it works :)
My hook is defined as:
def __before_publishing_traverse__(self, object, REQUEST):
""" Pre-traversal hook.
"""
if not XYZSkin.providedBy(REQUEST):
applySkin(REQUEST, XYZSkin)
One more question is whether I can/should use LocalSites here?
For the others who want to do something like me or simply
write a skin with Five I'll write few things that should
save you some time, I hope...
Look at:
/lib/python/zope/app/rotterdam # skin which (at last in Zope 2.9.4)
# is defined in new
way (with interfaces)
# and can be used as
template
/lib/python/zope/app/publisher/browser/metadirectives.py
# interfaces with good
docs
# about their use
and
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/SimplifySkinning
which is a proposal so it differs a bit in some places than eg.
rotterdam implementation.
--
Maciej Wisniowski
More information about the z3-five
mailing list