How to use the wicked.interfaces.IScope function in wicked

To help you get started, we’ve selected a few wicked examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github socialplanning / opencore / opencore / nui / wiki / scope.py View on Github external
from Acquisition import aq_parent
from Acquisition import aq_inner

from opencore.interfaces import IOpenPage
from opencore.project.browser.interfaces import IProjectInfo
from wicked.interfaces import IScope
from wicked.interfaces import IAmWickedField
from zope.component import adapts
from zope.interface import implements

class ProjectScope(object):
    """
    Defines a scope of within a contained project, or (if none) the
    parent container.
    """
    implements(IScope)
    adapts(IAmWickedField, IOpenPage)

    def __init__(self, field, context):
        self.field = field
        self.context = context

    def __call__(self):
        # XXX 2009-01-05: This is not hit by any unit tests. Write something?
        projectinfo = IProjectInfo(self.context)
        scope_obj = projectinfo.project
        if scope_obj is None:
            scope_obj = aq_parent(aq_inner(self.context))
        return '/'.join(scope_obj.getPhysicalPath())

wicked

wicked is a compact syntax for doing wiki-like content linking and creation in zope and plone

GPL-3.0
Latest version published 10 years ago

Package Health Score

36 / 100
Full package analysis