예제 #1
0
파일: localsite.py 프로젝트: goschtl/zope
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)
예제 #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)
예제 #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))
예제 #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)
예제 #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))
예제 #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)
예제 #8
0
파일: browser.py 프로젝트: goschtl/zope
    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)
예제 #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)
예제 #10
0
파일: browser.py 프로젝트: bendavis78/zope
    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"
예제 #11
0
파일: browser.py 프로젝트: goschtl/zope
    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"
예제 #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())