Ensure the given context implements ISite. The importance of this
method is that it will ensure the given context is an ISite regardless of
the Zope version (Zope 2.9 had a really hacked up SiteManager mechanism
we have to account for).
>>> from zope.app.component.interfaces import ISite, IPossibleSite
>>> from OFS.Folder import Folder
>>> if not IPossibleSite.implementedBy(Folder):
... from zope import interface
... from Products.Five.site.metaconfigure import (FiveSite,
... classSiteHook)
... classSiteHook(Folder, FiveSite)
... interface.classImplements(Folder, IPossibleSite)
>>> om = Folder('foo')
>>> ISite.providedBy(om)
False
>>> from iccommunity.core.setuphandlers import ensure_site
>>> ensure_site(om)
>>> ISite.providedBy(om)
True
|