src/ztfy/utils/schema.py
branchZTK-1.1
changeset 165 9615e7d1a4ee
parent 148 d3668ecd9137
child 190 5152d59c147c
--- a/src/ztfy/utils/schema.py	Mon Aug 20 18:54:13 2012 +0200
+++ b/src/ztfy/utils/schema.py	Thu Aug 30 14:58:30 2012 +0200
@@ -20,7 +20,7 @@
 
 # import Zope3 interfaces
 from z3c.form.interfaces import IWidget
-from zope.schema.interfaces import ITextLine, IDecimal
+from zope.schema.interfaces import ITextLine, IDecimal, IList
 
 # import local interfaces
 
@@ -28,7 +28,7 @@
 from z3c.form.converter import BaseDataConverter, FormatterValidationError
 from zope.component import adapts
 from zope.interface import implements
-from zope.schema import TextLine, Decimal
+from zope.schema import TextLine, Decimal, List
 from zope.schema._bootstrapfields import InvalidValue
 
 # import local packages
@@ -108,3 +108,20 @@
             return decimal.Decimal(value)
         except decimal.InvalidOperation:
             raise FormatterValidationError(self.errorMessage, value)
+
+
+#
+# TextLine list field
+#
+
+class ITextLineListField(IList):
+    """Marker interface for textline list field"""
+
+
+class TextLineListField(List):
+    """TextLine list field"""
+
+    implements(ITextLineListField)
+
+    def __init__(self, value_type=None, unique=False, **kw):
+        super(TextLineListField, self).__init__(value_type=TextLine(), unique=True, **kw)