2008-02-28

interfaces.py

  2008-02-28 00:27

...

### -*- coding: utf-8 -*- #############################################
#######################################################################
"""Interfaces for the Zope 3 based objectqueue package

$Id: interfaces.py 50217 2008-01-21 11:02:48Z corbeau $
"""
__author__  = "Yegor Shershnev, 2008"
__license__ = "GPL"
__version__ = "$Revision: 50217 $"
 
from zope.interface import Interface

from zope.schema import Text, TextLine, Field, Bool, Datetime, Int, Choice
from zope.app.container.interfaces import IContained, IContainer
from zope.app.container.constraints import ItemTypePrecondition
from zope.app.container.constraints import ContainerTypesConstraint
from zope.schema.vocabulary import SimpleVocabulary
from zope.app.container.interfaces import IReadContainer

class IObjectQueueHandler(Interface) :
    
    def itemAdd(ob) :
        """ Add object into queue
        """

    def itemRemove(ob) :
        """ Remove object from queue
        """

    def itemModify(ob) :
        """ Modufy object in queue
        """


class IObjectQueue(IObjectQueueHandler, IReadContainer):

    pass


class IObjectQueueDataAdd(Interface) :

    maxlen = Int(
        title=u"Maximum Length",
        description=u"maximum length of queue",
        default=10,
        )

    style = Choice(
        title=u'Style',
        description=u"Style of queue",
        vocabulary = SimpleVocabulary.fromValues([u"fifo", u"lifo"]),
        default=u"fifo",
        required=True,
        )
    
    #condition

    order = Choice(
        title=u'Order',
        description=u"Order",
        vocabulary = SimpleVocabulary.fromValues([u"straight", u"reverse"]),
        default=u"straight",
        required=True,
        )


class IObjectQueueData(IObjectQueueDataAdd) :
    
    length  = Int(
        title=u"Length",
        description=u"Current length of queue",
        default=0,
        readonly=True,
        )


class IObjectQueueAble(Interface) :
    """ Interface of objects that can be queued
    """
    
Официальный сайт Zope3 Московская группа изучения реактивного движения The Dream Bot Site noooxml