[CMF-checkins] CVS: CMF/CMFTopic/interfaces - Criterion.py:1.5
Yvo Schubbe
cvs-admin at zope.org
Mon Dec 1 08:55:47 EST 2003
Update of /cvs-repository/CMF/CMFTopic/interfaces
In directory cvs.zope.org:/tmp/cvs-serv16302/CMFTopic/interfaces
Modified Files:
Criterion.py
Log Message:
some code modernization:
- death to string module
- death to apply
- import and whitespace cleanup
=== CMF/CMFTopic/interfaces/Criterion.py 1.4 => 1.5 ===
--- CMF/CMFTopic/interfaces/Criterion.py:1.4 Wed Nov 28 14:06:27 2001
+++ CMF/CMFTopic/interfaces/Criterion.py Mon Dec 1 08:55:46 2003
@@ -1,22 +1,28 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
+""" Declare interface for search criterion classes, as used by Topic instances
+to build their queries.
+
+$Id$
"""
-import Interface
-class Criterion(Interface.Base):
+try:
+ from Interface import Interface
+except ImportError:
+ # for Zope versions before 2.6.0
+ from Interface import Base as 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
@@ -24,45 +30,45 @@
having to be too aware of the Criteria types.
"""
- def Type(self):
+ def Type():
"""\
Return the type of criterion object this is (ie - 'List Criterion')
"""
- def Field(self):
+ def Field():
"""\
Return the field this criterion object searches on.
"""
- def Description(self):
+ def Description():
"""\
Return a brief description of the criteria type.
"""
- def editableAttributes(self):
+ 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(self):
+ def getEditForm():
"""\
Return the name of a DTML component used to edit criterion.
Editforms should be specific to their type of criteria.
"""
- def apply(self, command):
+ 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
- apply(self.edit, (), command).
+ self.edit(**command).
"""
- def edit(self, **kw):
+ def edit(**kw):
"""\
The signature of this method should be specific to the
criterion. Using the values in the attribute
@@ -71,7 +77,7 @@
having to know too much about the structure.
"""
- def criteriaItems(self):
+ def criteriaItems():
"""\
Return a sequence of key-value tuples, each representing
a value to be injected into the query dictionary (and,
More information about the CMF-checkins
mailing list