[Zodb-checkins] CVS: Zope3/src/zope/interface/common -
mapping.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Feb 24 09:28:29 EST 2004
Update of /cvs-repository/Zope3/src/zope/interface/common
In directory cvs.zope.org:/tmp/cvs-serv925/interface/common
Modified Files:
mapping.py
Log Message:
Removed zope.utilities.session's mapping interfaces. They duplicated the
ones in interface.common.mapping; and the ones that did not overlap I just
added to common.mapping. This shoudl have been done like this from the
beginning. I have no clue why it wasn't.
=== Zope3/src/zope/interface/common/mapping.py 1.4 => 1.5 ===
--- Zope3/src/zope/interface/common/mapping.py:1.4 Mon Feb 3 09:59:24 2003
+++ Zope3/src/zope/interface/common/mapping.py Tue Feb 24 09:28:28 2004
@@ -11,10 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Mapping Interfaces
+
$Id$
"""
-
from zope.interface import Interface
class IItemMapping(Interface):
@@ -27,6 +27,7 @@
A KeyError is raised if there is no value for the key.
"""
+
class IReadMapping(IItemMapping):
"""Basic mapping interface
"""
@@ -38,29 +39,43 @@
"""
def __contains__(key):
- """Tell if a key exists in the mapping
- """
+ """Tell if a key exists in the mapping."""
+
+
+class IWriteMapping(Interface):
+ """Mapping methods for changing data"""
+
+ def __delitem__(key):
+ """Delete a value from the mapping using the key."""
+
+ def __setitem__(key, value):
+ """Set a new item in the mapping."""
+
class IEnumerableMapping(IReadMapping):
- """Mapping objects whose items can be enumerated
+ """Mapping objects whose items can be enumerated.
"""
def keys():
- """Return the keys of the mapping object
+ """Return the keys of the mapping object.
"""
def __iter__():
- """Return an iterator for the keys of the mapping object
+ """Return an iterator for the keys of the mapping object.
"""
def values():
- """Return the values of the mapping object
+ """Return the values of the mapping object.
"""
def items():
- """Return the items of the mapping object
+ """Return the items of the mapping object.
"""
def __len__():
- """Return the number of items
+ """Return the number of items.
"""
+
+
+class IMapping(IReadMapping, IWriteMapping, IEnumerableMapping):
+ ''' Full mapping interface '''
More information about the Zodb-checkins
mailing list