def disableLocalSiteHook(obj): """Remove __before_traverse__ hook for Local Site """ # This method is of course deprecated too, but issuing a warning is # silly. disableSite(obj) clearSite() obj.setSiteManager(None)
def disableFolder(folder): zope.event.notify(ChildSiteWillBeRemovedEvent(folder)) # remove local site components disableSite(folder) # reindex the object so that the object_provides index is # aware that we've removed it reindexObjectProvides(folder) zope.event.notify(ChildSiteRemovedEvent(folder))
def delete_site(self): if not self.is_site(): raise ValueError(_('Not a local site.')) if interfaces.IRoot.providedBy(self.context): raise ValueError(_("Can't disable local site on Silva Root.")) sm = ISite(self.context).getSiteManager() if list(sm.registeredAdapters()): raise ValueError(_('Still have registered customizations.')) if list(sm.registeredUtilities()): raise ValueError(_('Still have registered services.')) disableSite(self.context)
def disable_childsite(context): notify(ChildSiteWillBeRemovedEvent(context)) # remove local site components disableSite(context) # remove IChildSite noLongerProvides(context, IChildSite) context.reindexObject(idxs=('object_provides')) notify(ChildSiteRemovedEvent(context))
def delete_site(self): if not self.is_site(): raise ValueError(_(u'Not a local site.')) if interfaces.IRoot.providedBy(self.context): raise ValueError(_(u"Can't disable local site on Silva Root.")) sm = ISite(self.context).getSiteManager() if list(sm.registeredAdapters()): raise ValueError(_(u'Still have registered customizations.')) if list(sm.registeredUtilities()): raise ValueError(_(u'Still have registered services.')) disableSite(self.context)
def unmakeSite(self): if not self.isSite(): raise ValueError('This is not a site') disableSite(self.context) # disableLocalSiteHook circumcised our context so that it's # not an ISite anymore. That can mean that certain things for # it can't be found anymore. So, for the rest of this request # (which will be over in about 20 CPU cycles), already clear # the local site from the thread local. clearSite() self.context.setSiteManager(None)
def unmakeSite(self): if not self.isSite(): raise ValueError('This is not a site') disableSite(self.context) # disableLocalSiteHook circumcised our context so that it's # not an ISite anymore. That can mean that certain things for # it can't be found anymore. So, for the rest of this request # (which will be over in about 20 CPU cycles), already clear # the local site from the thread local. clearSite() self.context.setSiteManage(None)
def unmakeSite(self): """Convert a site to a possible site""" if not self.isSite(): raise ValueError('This is not a site') disableSite(self.context) # disableLocalSiteHook circumcised our context so that it's # not an ISite anymore. That can mean that certain things for # it can't be found anymore. So, for the rest of this request # (which will be over in about 20 CPU cycles), already clear # the local site from the thread local. clearSite() return "This object is no longer a site"
def disable(self): """Disable a lineage subsite on this context. """ ctx = self.context notify(ChildSiteWillBeRemovedEvent(ctx)) # remove local site components disableSite(ctx) # remove IChildSite noLongerProvides(ctx, IChildSite) ctx.reindexObject(idxs=('object_provides')) notify(ChildSiteRemovedEvent(ctx)) # redirect self.request.response.redirect(ctx.absolute_url())