Index: /main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/utils/converters.py
===================================================================
--- /main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/utils/converters.py	(revision 5312)
+++ /main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/utils/converters.py	(revision 5313)
@@ -1,4 +1,5 @@
 """Converters for zope.schema-based datatypes.
 """
+import datetime
 import grok
 from zope.component import getMultiAdapter
@@ -8,5 +9,5 @@
 except ImportError:
     from zope.browser.interfaces import ITerms
-from zope.schema.interfaces import IBool, IText, IInt, IChoice
+from zope.schema.interfaces import IBool, IText, IInt, IChoice, IDate
 from waeup.sirp.interfaces import ISchemaTypeConverter
 
@@ -52,4 +53,6 @@
 
     def toString(self, value, strict=True):
+        """Convert given `value` to string according to assigned field type.
+        """
         if strict:
             self.context.validate(value)
@@ -164,2 +167,59 @@
         return super(ChoiceConverter, self).toString(value=value,
                                                      strict=strict)
+
+class DateConverter(Converter):
+    """A converter for zope.schema.IDate fields.
+
+    Converts date to string and vice versa. Stringified dates are
+    expected in format ``YYYY-MM-DD``.
+
+    To support at least some other formats, we accept for conversion
+    from string also the following formats:
+
+    * ``YYYY/MM/DD``
+    
+    * ``DD/MM/YYYY``
+    
+    * ``D/M/YYYY``
+
+    * ``DD.MM.YYYY``
+
+    * ``D.M.YYYY``
+
+    When converting to strings, always 'YYYY-MM-DD' is returned.
+
+    For convenience, when converting from strings also string data
+    separated by space is stripped before processing. Therefore
+    strings like '1990-04-01 12:12:01 GMT +1' will also work.
+    """
+    grok.context(IDate)
+    grok.provides(ISchemaTypeConverter)
+
+    #: List of supported date formats in `strftime()` notation.
+    formats = ['%Y-%m-%d', '%Y/%m/%d' , '%d/%m/%Y', '%D/%M/%Y',
+               '%d.%m.%Y', '%D.%M.%Y']
+    
+    def _convertValueFromString(self, string):
+        orig_string = string
+        if string is NONE_STRING_VALUE:
+            string = None
+        if string is None:
+            return None
+        value = None
+        if ' ' in string:
+            string = string.split(' ')[0]
+        for format in self.formats:
+            try:
+                value = datetime.datetime.strptime(string, format)
+                break
+            except ValueError:
+                pass
+        if value is None:
+            raise ValueError(
+                'Cannot convert to date: %s. Use YYYY-MM-DD.' %
+                orig_string)
+        value = value.date()
+        return value
+
+    def _convertValueToString(self, value):
+        return datetime.date.strftime(value, '%Y-%m-%d')
