[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/PropertySets - IPropertySet.py:1.2 IPropertySetDef.py:1.2 PropertySetDef.py:1.2 __init__.py:1.2
Jim Fulton
jim@zope.com
Mon, 10 Jun 2002 19:28:39 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/PropertySets
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/OFS/PropertySets
Added Files:
IPropertySet.py IPropertySetDef.py PropertySetDef.py
__init__.py
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.
=== Zope3/lib/python/Zope/App/OFS/PropertySets/IPropertySet.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""
+
+$Id$"
+"""
+from Interface import Interface
+
+class IPropertySet(Interface):
+
+ """
+ Interface to access a collection of properties
+ """
+
+ def __getitem__(name):
+ """
+ Return the value associated with the property
+ """
+
+ def __setitem__(name, value):
+ """
+ Store the value for the property.
+ """
+
+ def getField(name):
+ """
+ Get the IField that defines the property 'name'.
+ """
+
+ def has_field(name):
+ """
+ True if the PropertySet has the property name
+ """
+
+ def fieldNames():
+ """
+ Returns a list of the names of the properties
+ """
+
+ def __iter__():
+ """
+ Returns an iterator over the names of the properties
+ """
+
+ def __len__():
+ """
+ Returns the number of properties in the PropertySet
+ """
=== Zope3/lib/python/Zope/App/OFS/PropertySets/IPropertySetDef.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""
+
+$Id$"
+"""
+from Interface import Interface
+
+class IPropertySetDef(Interface):
+
+ """
+ Interface to manage a collection of properties
+ """
+
+ def __init__():
+ """
+ Create an empty PropertySetDef
+ """
+
+ def addField(name,field):
+ """
+ Add a IField object to the PropertySet under name 'name'.
+ """
+
+ def getField(name):
+ """
+ Return the IField defining the property 'name'.
+ """
+
+ def has_field(name):
+ """
+ True if the PropertySet has a property named 'name'.
+ """
+
+ def fieldNames():
+ """
+ Returns a list of the property names defined by the PropertySet
+ """
+
+ def __iter__():
+ """
+ Returns an iterator over the IFields
+ """
+
+ def __len__():
+ """
+ Returns the number of fields in the PropertySetDef
+ """
=== Zope3/lib/python/Zope/App/OFS/PropertySets/PropertySetDef.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+from Zope.App.OFS.PropertySets.IPropertySetDef import IPropertySetDef
+from Zope.Exceptions import DuplicationError
+
+class PropertySetDef:
+
+ __implements__ = IPropertySetDef
+
+ ############################################################
+ # Implementation methods for interface
+ # Zope.App.OFS.PropertySets.IPropertySetDef.
+
+ def __init__(self):
+ '''See interface IPropertySetDef'''
+ self.fields = {}
+ self.namelist = []
+
+ def has_field(self, name):
+ '''See interface IPropertySetDef'''
+ return name in self.fields
+
+ def addField(self, name, field):
+ '''See interface IPropertySetDef'''
+ if name in self.fields:
+ raise DuplicationError(name)
+ self.fields[name] = field
+ self.namelist.append(name)
+
+ def getField(self, name):
+ '''See interface IPropertySetDef'''
+ return self.fields[name]
+
+ def fieldNames(self):
+ '''See interface IPropertySetDef'''
+ return self.namelist
+
+ def __len__(self):
+ '''See interface IPropertySetDef'''
+ return len(self.namelist)
+
+ def __iter__(self):
+ '''See interface IPropertySetDef'''
+ return iter([ self.fields[x] for x in self.namelist ])
+
+ #
+ ############################################################
=== Zope3/lib/python/Zope/App/OFS/PropertySets/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################