[Zope3-checkins] CVS: Zope3/src/zope/schema - __init__.py:1.14 _field.py:1.21 interfaces.py:1.29

Gary Poster gary at zope.com
Tue Aug 12 15:17:14 EDT 2003


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv5995

Modified Files:
	__init__.py _field.py interfaces.py 
Log Message:
Add date field.  Largely a copy and paste from datetime.



=== Zope3/src/zope/schema/__init__.py 1.13 => 1.14 ===
--- Zope3/src/zope/schema/__init__.py:1.13	Mon Jul 28 18:22:08 2003
+++ Zope3/src/zope/schema/__init__.py	Tue Aug 12 14:16:40 2003
@@ -20,7 +20,7 @@
 from zope.schema._field import MinMaxLen, Enumerated, Sequence
 from zope.schema._field import Bytes, BytesLine
 from zope.schema._field import Text, TextLine, Bool, Int, Float, Tuple, List
-from zope.schema._field import Password, Dict, Datetime, SourceText
+from zope.schema._field import Password, Dict, Datetime, Date, SourceText
 from zope.schema._field import Object, URI, Id
 from zope.schema._field import EnumeratedTextLine, EnumeratedInt
 from zope.schema._field import EnumeratedDatetime, EnumeratedFloat


=== Zope3/src/zope/schema/_field.py 1.20 => 1.21 ===
--- Zope3/src/zope/schema/_field.py:1.20	Sat Aug  2 13:24:57 2003
+++ Zope3/src/zope/schema/_field.py	Tue Aug 12 14:16:40 2003
@@ -31,7 +31,7 @@
 from zope.schema.interfaces import IInterfaceField
 from zope.schema.interfaces import IBool, IInt, IBytes, IBytesLine, IFloat
 from zope.schema.interfaces import IDatetime, ISequence, ITuple, IList, IDict
-from zope.schema.interfaces import IPassword, IObject
+from zope.schema.interfaces import IPassword, IObject, IDate
 from zope.schema.interfaces import IEnumeratedDatetime, IEnumeratedTextLine
 from zope.schema.interfaces import IEnumeratedInt, IEnumeratedFloat
 from zope.schema.interfaces import IURI, IId
@@ -42,7 +42,7 @@
 from zope.schema._bootstrapfields import Text, TextLine, Bool, Int, Password
 from zope.schema._bootstrapfields import EnumeratedTextLine, EnumeratedInt
 from zope.schema.fieldproperty import FieldProperty
-from datetime import datetime
+from datetime import datetime, date
 
 # Fix up bootstrap field types
 Field.title       = FieldProperty(IField['title'])
@@ -149,6 +149,11 @@
 class EnumeratedDatetime(Datetime):
     __doc__ = IEnumeratedDatetime.__doc__
     implements(IEnumeratedDatetime)
+
+class Date(Enumerated, Orderable, Field):
+    __doc__ = IDate.__doc__
+    implements(IDate)
+    _type = date
 
 class InterfaceField(Field):
     __doc__ = IInterfaceField.__doc__


=== Zope3/src/zope/schema/interfaces.py 1.28 => 1.29 ===
--- Zope3/src/zope/schema/interfaces.py:1.28	Tue Aug  5 10:25:19 2003
+++ Zope3/src/zope/schema/interfaces.py	Tue Aug 12 14:16:40 2003
@@ -327,6 +327,9 @@
     The value may be constrained to an element of a specified list.
     """
 
+class IDate(IMinMax, IEnumerated, IField):
+    u"""Field containing a date."""
+
 def _is_field(value):
     if not IField.isImplementedBy(value):
         return False




More information about the Zope3-Checkins mailing list