[CMF-checkins] CVS: Products/CMFTopic/z2interfaces - Criterion.py:1.1.2.1 __init__.py:1.1.2.1

Tres Seaver tseaver at palladion.com
Fri Jul 15 18:41:24 EDT 2005


Update of /cvs-repository/Products/CMFTopic/z2interfaces
In directory cvs.zope.org:/tmp/cvs-serv16776/CMFTopic/z2interfaces

Added Files:
      Tag: tseaver-z3_interfaces-branch
	Criterion.py __init__.py 
Log Message:


Branch for Z3-ification of CMF interfaces

 - All interfaces declared in the CMF are now Zope3-style interfaces
   (the one remaining exception is to leave Zope2's
   'webdav.WriteLockInterface' declared by CMFCore.PortalContent and
   derivatives.).

TOOD

  - Clean up XXX'es noted during this pass.


=== Added File Products/CMFTopic/z2interfaces/Criterion.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" Declare interface for search criterion classes, as used by Topic instances
to build their queries.

$Id: Criterion.py,v 1.1.2.1 2005/07/15 22:41:24 tseaver Exp $
"""

from Interface import Interface


class Criterion(Interface):
    """\
    A Topic is composed of Criterion objects which specify the query
    used for the Topic.  By supplying some basic information, the
    Criterion objects can be plugged into Topics without the Topic
    having to be too aware of the Criteria types.
    """

    def Type():
        """\
        Return the type of criterion object this is (ie - 'List Criterion')
        """

    def Field():
        """\
        Return the field this criterion object searches on.
        """

    def Description():
        """\
        Return a brief description of the criteria type.
        """

    def editableAttributes():
        """\
        Returns a tuble of editable attributes.  The values of this
        are used by the topic to build commands to send to the
        'edit' method based on each criterion's setup.
        """

    def getEditForm():
        """\
        Return the name of a DTML component used to edit criterion.
        Editforms should be specific to their type of criteria.
        """

    def apply(command):
        """\
        To make it easier to apply values from the rather dynamic
        Criterion edit form using Python Scripts, apply takes a
        mapping object as a default and applies itself to self.edit.

        It's basically a nice and protected wrapper around
        self.edit(**command).
        """

# XXX: Interfaces have to specify the signature.
##    def edit(**kw):
##        """\
##        The signature of this method should be specific to the
##        criterion.  Using the values in the attribute
##        '_editableAttributes', the Topic can apply the right
##        commands to each criteria object as its being edited without
##        having to know too much about the structure.
##        """

    def getCriteriaItems():
        """\
        Return a sequence of key-value tuples, each representing
        a value to be injected into the query dictionary (and,
        therefore, tailored to work with the catalog).
        """


=== Added File Products/CMFTopic/z2interfaces/__init__.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""\
Loads interface names into the package.
"""

from Criterion import Criterion



More information about the CMF-checkins mailing list