Example #1
0
    def test_disable(self):
        from collective.lineage.interfaces import IChildSite

        utils.enable_childsite(self.childsite)
        self.assertTrue(IChildSite.providedBy(self.childsite))
        utils.disable_childsite(self.childsite)
        self.assertFalse(IChildSite.providedBy(self.childsite))
    def test_disable(self):
        from collective.lineage.interfaces import IChildSite

        utils.enable_childsite(self.childsite)
        self.assertTrue(IChildSite.providedBy(self.childsite))
        utils.disable_childsite(self.childsite)
        self.assertFalse(IChildSite.providedBy(self.childsite))
Example #3
0
def enableChildSite(event):
    """When a lineage folder is created, turn it into a component site
    """
    if not IChildSite.providedBy(event.object):
        return
    folder = event.object
    enableFolder(folder)
Example #4
0
def getNextChildSite(context, portal):
    """Returns the nearest parent object implementing IChildSite.
    Code borrowed from plone.app.layout.navigation.root.getNavigationRootObject
    """
    obj = context
    while not IChildSite.providedBy(obj) and\
            aq_base(obj) is not aq_base(portal):
        obj = utils.parent(obj)
    return obj
Example #5
0
 def _find_site(ctx):
     # First, stop at IPloneSiteRoot
     if IPloneSiteRoot.providedBy(ctx):
         return ctx
     # Then walk up
     ctx = aq_parent(ctx)
     if IChildSite.providedBy(ctx):
         return ctx
     return _find_site(ctx)
 def _find_site(ctx):
     # First, stop at IPloneSiteRoot
     if IPloneSiteRoot.providedBy(ctx):
         return ctx
     # Then walk up
     ctx = aq_parent(ctx)
     if IChildSite.providedBy(ctx):
         return ctx
     return _find_site(ctx)
Example #7
0
def absolute_url(self, relative=0):
    if not IChildSite.providedBy(self):
        return self._absolute_url(relative)
    elif relative:
        self.virtual_url_path()

    url = map_url('/'.join(self.getPhysicalPath()),
                  aq_acquire(self, 'REQUEST'))

    return url
Example #8
0
def getNextChildSite(context, portal):
    """Returns the nearest parent object implementing IChildSite.
    Code borrowed from plone.app.layout.navigation.root.getNavigationRootObject
    """
    obj = context
    while not IChildSite.providedBy(obj) and aq_base(obj) is not aq_base(portal):
        obj = utils.parent(obj)
        if obj is None:
            return
    return obj
Example #9
0
def absolute_url(self, relative=0):
    if not IChildSite.providedBy(self):
        return self._absolute_url(relative)
    elif relative:
        self.virtual_url_path()

    url = map_url('/'.join(self.getPhysicalPath()),
                  aq_acquire(self, 'REQUEST'))

    return url
Example #10
0
 def isChildSite(self):
     """Return ``True``, if the current context is within a childsite.
     """
     context = self.context
     request = self.request
     portal_state = getMultiAdapter(
         (context, request),
         name="plone_portal_state"
     )
     root_path = portal_state.navigation_root_path()
     nav_root = self.context.restrictedTraverse(root_path)
     return IChildSite.providedBy(nav_root)
Example #11
0
 def isChildSite(self):
     """Return ``True``, if the current context is within a childsite.
     """
     context = self.context
     request = self.request
     portal_state = getMultiAdapter(
         (context, request),
         name="plone_portal_state"
     )
     root_path = portal_state.navigation_root_path()
     nav_root = self.context.restrictedTraverse(root_path)
     return IChildSite.providedBy(nav_root)
Example #12
0
 def current_childsite(self):
     """Return the current childsite.
     """
     childsite = None
     context = self.context
     request = self.request
     portal_state = getMultiAdapter(
         (context, request),
         name="plone_portal_state"
     )
     root_path = portal_state.navigation_root_path()
     nav_root = self.context.restrictedTraverse(root_path)
     if IChildSite.providedBy(nav_root):
         childsite = nav_root
     return childsite
Example #13
0
 def current_childsite(self):
     """Return the current childsite.
     """
     childsite = None
     context = self.context
     request = self.request
     portal_state = getMultiAdapter(
         (context, request),
         name="plone_portal_state"
     )
     root_path = portal_state.navigation_root_path()
     nav_root = self.context.restrictedTraverse(root_path)
     if IChildSite.providedBy(nav_root):
         childsite = nav_root
     return childsite
Example #14
0
 def getFields(self):
     if IChildSite.providedBy(self.context):
         return self.fields
     return []
Example #15
0
 def __call__(self):
     return IChildSite.providedBy(self.context)
Example #16
0
 def isChildSite(self):
     portal_state = self.context.restrictedTraverse("plone_portal_state")
     root_path = portal_state.navigation_root_path()
     nav_root = self.context.restrictedTraverse(root_path)
     return IChildSite.providedBy(nav_root)
Example #17
0
 def isChildSite(self):
     portal_state = self.context.restrictedTraverse('plone_portal_state')
     root_path = portal_state.navigation_root_path()
     nav_root = self.context.restrictedTraverse(root_path)
     return IChildSite.providedBy(nav_root)
Example #18
0
 def enabled(self):
     """True, if context is a lineage subsite.
     """
     return IChildSite.providedBy(self.context)
 def __call__(self):
     return IChildSite.providedBy(self.context)
Example #20
0
 def enabled(self):
     """True, if context is a lineage subsite.
     """
     return IChildSite.providedBy(self.context)