Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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))
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
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 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))
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
0
    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"
Ejemplo n.º 11
0
    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"
Ejemplo n.º 12
0
    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())