[Zope3-checkins] SVN: Zope3/trunk/ Added new Time schema field type.

Rocky Burt rocky at serverzen.com
Mon May 22 17:08:13 EDT 2006


Log message for revision 68247:
  Added new Time schema field type.

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/schema/__init__.py
  U   Zope3/trunk/src/zope/schema/_field.py
  U   Zope3/trunk/src/zope/schema/interfaces.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2006-05-22 20:22:58 UTC (rev 68246)
+++ Zope3/trunk/doc/CHANGES.txt	2006-05-22 21:08:12 UTC (rev 68247)
@@ -10,6 +10,8 @@
 
     New features
 
+      - Added new Time field type to zope.schema
+
     Restructuring
 
     Bug fixes

Modified: Zope3/trunk/src/zope/schema/__init__.py
===================================================================
--- Zope3/trunk/src/zope/schema/__init__.py	2006-05-22 20:22:58 UTC (rev 68246)
+++ Zope3/trunk/src/zope/schema/__init__.py	2006-05-22 21:08:12 UTC (rev 68247)
@@ -21,7 +21,7 @@
 from zope.schema._field import Text, TextLine, Bool, Int, Float
 from zope.schema._field import Tuple, List, Set, FrozenSet
 from zope.schema._field import Password, Dict, Datetime, Date, Timedelta
-from zope.schema._field import SourceText
+from zope.schema._field import Time, SourceText
 from zope.schema._field import Object, URI, Id, DottedName
 from zope.schema._field import InterfaceField
 from zope.schema._schema import getFields, getFieldsInOrder

Modified: Zope3/trunk/src/zope/schema/_field.py
===================================================================
--- Zope3/trunk/src/zope/schema/_field.py	2006-05-22 20:22:58 UTC (rev 68246)
+++ Zope3/trunk/src/zope/schema/_field.py	2006-05-22 21:08:12 UTC (rev 68247)
@@ -19,7 +19,7 @@
 __docformat__ = 'restructuredtext'
 
 import re
-from datetime import datetime, date, timedelta
+from datetime import datetime, date, timedelta, time
 from sets import Set as SetType
 
 from zope.interface import classImplements, implements
@@ -33,6 +33,7 @@
 from zope.schema.interfaces import IBool, IInt, IFloat, IDatetime, IFrozenSet
 from zope.schema.interfaces import IChoice, ITuple, IList, ISet, IDict
 from zope.schema.interfaces import IPassword, IObject, IDate, ITimedelta
+from zope.schema.interfaces import ITime
 from zope.schema.interfaces import IURI, IId, IFromUnicode
 from zope.schema.interfaces import ISource, IBaseVocabulary
 from zope.schema.interfaces import IContextSourceBinder
@@ -183,6 +184,11 @@
     __doc__ = ITimedelta.__doc__
     implements(ITimedelta)
     _type = timedelta
+    
+class Time(Orderable, Field):
+    __doc__ = ITime.__doc__
+    implements(ITime)
+    _type = time
 
 class Choice(Field):
     """Choice fields can have a value found in a constant or dynamic set of

Modified: Zope3/trunk/src/zope/schema/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/schema/interfaces.py	2006-05-22 20:22:58 UTC (rev 68246)
+++ Zope3/trunk/src/zope/schema/interfaces.py	2006-05-22 21:08:12 UTC (rev 68247)
@@ -333,6 +333,9 @@
 class ITimedelta(IMinMax, IField):
     u"""Field containing a timedelta."""
 
+class ITime(IMinMax, IField):
+    u"""Field containing a time."""
+
 def _is_field(value):
     if not IField.providedBy(value):
         return False



More information about the Zope3-Checkins mailing list