How to use the zope.interface.Interface function in Zope

To help you get started, we’ve selected a few Zope 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 ned14 / Easyshop / src / easyshop.core / easyshop / core / interfaces / data.py View on Github external
# zope imports
from zope.interface import Interface

class IData(Interface):
    """Provides methods to return content objects in several formats.
    """
    def asDict():
        """Returns context's attributes as dict.
        """
github collective / Products.EasyNewsletter / src / Products / EasyNewsletter / behaviors / external_delivery_service.py View on Github external
# -*- coding: utf-8 -*-

# from plone import schema
from plone.autoform.interfaces import IFormFieldProvider
from plone.supermodel import model
# from Products.EasyNewsletter import _
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import provider


class IExternalDeliveryServiceMarker(Interface):
    pass


# XXX not implemented yet!
@provider(IFormFieldProvider)
class IExternalDeliveryService(model.Schema):
    """
    """

    # project = schema.TextLine(
    #     title=_(u'Project'),
    #     description=_(u'Give in a project name'),
    #     required=False,
    # )
github ned14 / Easyshop / easyshop.core / easyshop / core / interfaces / stocks.py View on Github external
class IStockManagement(Interface):
    """Provides methods to manage stock information.
    """
    def getStockInformations():
        """Returns existing stock information.
        """
        
    def getStockInformationFor(product):
        """Returns first valid stock information for given product.
        """
        
    def removeCart(cart):
        """Removes product which are within given cart from stock.
        """
        
class IAvailablility(Interface):
    """Provides calculation of availability of a product.
    """
    
    def isAvailable():
        """Returns True if the product is available.
        """
        
class IStockAmountIsZeroEvent(Interface):
    """An event which is sent when the stock amount of a product is zero or 
    less.
    """
    product = Attribute("The product for which the stock amount is zero.")
github ploneintranet / ploneintranet / src / ploneintranet / messaging / interfaces.py View on Github external
"""Return all messages."""

    def add_message(message):
        """Add a message that provides `IMessage`."""

    def mark_read():
        """Mark the conversation and all contained messages as read."""

    def __getitem__(uid):
        """Return the message with the uid `uid`."""

    def __delitem__(uid):
        """Delete the message with the uid `uid`."""


class IMessage(Interface):
    """A message."""

    # __parent__ = schema.Object(
    #     title=u"The parent `IConversation' object"
    # )

    sender = schema.TextLine(
        title=u'Username of the sender'
    )

    recipient = schema.TextLine(
        title=u'Username of the recipient'
    )

    text = schema.Text(
        title=u'Text of the message'
github ned14 / Easyshop / easyshop.core / easyshop / core / interfaces / shipping.py View on Github external
"""
    """
    def getSelectedShippingMethod():
        """Returns the selected shipping method of the current authenticated 
        customer.
        """
            
    def getShippingMethod(id):
        """Returns shipping method by given id.
        """    
        
    def getShippingMethods():
        """Returns all shipping methods.
        """
            
class IShippingPriceManagement(Interface):
    """Provides all methods to manage the shipping prices. This includes also 
    calculation of prices and taxes (maybe this will separated later to 
    different interfaces, e.g.: IShippingPriceManagement, IShippingPrices, 
    IShippingTaxes).
    """
    def getPriceNet():
        """Returns the net price of shipping.
        """

    def getPriceGross():
        """Returns the gross price of shipping. Returns the first valid        
        (All criteria are True) shipping price.
        """

    def getPriceForCustomer():
        """Returns the gross price of shipping for actual customer
github senaite / senaite.core / bika / lims / browser / idserver / view.py View on Github external
# Copyright 2018-2019 by it's authors.
# Some rights reserved, see README and LICENSE.

from bika.lims import api
from bika.lims import bikaMessageFactory as _
from bika.lims.idserver import get_config
from bika.lims.numbergenerator import INumberGenerator
from plone import protect
from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.component import getUtility
from zope.interface import Interface
from zope.interface import implements


class IIDserverView(Interface):
    """IDServerView
    """


class IDServerView(BrowserView):
    """ This browser view is to house ID Server related functions
    """
    implements(IIDserverView)
    template = ViewPageTemplateFile("templates/numbergenerator.pt")

    def __init__(self, context, request):
        super(BrowserView, self).__init__(context, request)
        self.context = context
        self.request = request

    def __call__(self):
github nlloyd / SubliminalCollaborator / libs / twisted / protocols / sip.py View on Github external
@type message: C{Message}
        @type addr: C{tuple}
        """
        raise NotImplementedError

    def handle_response(self, message, addr):
        """Override to define behavior for responses received.

        @type message: C{Message}
        @type addr: C{tuple}
        """
        raise NotImplementedError


class IContact(Interface):
    """A user of a registrar or proxy"""


class Registration:
    def __init__(self, secondsToExpiry, contactURL):
        self.secondsToExpiry = secondsToExpiry
        self.contactURL = contactURL

class IRegistry(Interface):
    """Allows registration of logical->physical URL mapping."""

    def registerAddress(domainURL, logicalURL, physicalURL):
        """Register the physical address of a logical URL.

        @return: Deferred of C{Registration} or failure with RegistrationError.
        """
github zopefoundation / z3c.form / src / z3c / form / interfaces.py View on Github external
During the process a copy of the current handlers object should be
        created and the other one is added to the copy. The return value is
        the copy.
        """


class IButtonHandler(zope.interface.Interface):
    """A handler managed by the button handlers."""

    def __call__(form, action):
        """Execute the handler."""


# ----[ Forms ]--------------------------------------------------------------

class IHandlerForm(zope.interface.Interface):
    """A form that stores the handlers locally."""

    handlers = zope.schema.Object(
        title=_('Handlers'),
        description=_('A list of action handlers defined on the form.'),
        schema=IButtonHandlers,
        required=True)


class IActionForm(zope.interface.Interface):
    """A form that stores executable actions"""

    actions = zope.schema.Object(
        title=_('Actions'),
        description=_('A list of actions defined on the form'),
        schema=IActions,
github ploneintranet / ploneintranet / src / ploneintranet / workspace / behaviors / group.py View on Github external
"""
        pass

    def deleteUser(self, user_id):
        """
        Remove properties stored for a user

        Note that membrane itself does not do anything here.  This
        indeed seems unneeded, as the properties are stored on the
        content item, so they get removed anyway without needing
        special handling.
        """
        pass


class IGroupsProvider(Interface):
    """
    Marks the object as a Membrane groups provider using a simple
    iteration over all workspaces that the user is a member of
    """


class MembraneWorkspaceGroupsProvider(object):
    """
    Determine the groups to which a principal belongs.
    A principal can be a user or a group.

    This is a plugin provider, used by Products.membrane. When the groups
    of a user are determined, this is roughly the call flow:

    The main method that plays a role is
    `Products.PluggableAuthService.PluggableAuthService.PluggableAuthService.
github plomino / Plomino / src / Products / CMFPlomino / interfaces.py View on Github external
class IPlominoLayer(IDefaultBrowserLayer):
    """Marker interface that defines a browser layer."""


class IPlominoSafeDomains(Interface):
    """Marker interface for PlominoSafeDomains
    """


class IPlominoContext(Interface):
    """Marker interface for Plomino objects."""


class IPlominoDocument(Interface):
    """ Marker interface for .PlominoDocument.PlominoDocument
    """


class IPlominoUtils(Interface):
    """ Marker interface for PlominoUtils
    """