[Checkins] SVN: z3c.form/trunk/src/z3c/form/converter.txt Fixed some missing coverage. We are at 100% again.

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Jun 28 17:16:58 EDT 2007


Log message for revision 77195:
  Fixed some missing coverage. We are at 100% again.
  

Changed:
  U   z3c.form/trunk/src/z3c/form/converter.txt

-=-
Modified: z3c.form/trunk/src/z3c/form/converter.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/converter.txt	2007-06-28 21:05:41 UTC (rev 77194)
+++ z3c.form/trunk/src/z3c/form/converter.txt	2007-06-28 21:16:58 UTC (rev 77195)
@@ -167,6 +167,14 @@
   FormatterValidationError:
       ("Not a valid number for this pattern u'#,##0.###;-#,##0.###'.", u'fff')
 
+The formatter validation error derives from the regular validation error, but
+allows you to specify the message that is output when asked for the
+documentation:
+
+  >>> err = converter.FormatterValidationError(u'Something went wrong.', None)
+  >>> err.doc()
+  u'Something went wrong.'
+
 Let's now look at the float data converter.
 
   >>> rating = zope.schema.Float()
@@ -229,6 +237,11 @@
   >>> ddc.toWidgetValue(bday)
   u'80/01/25'
 
+If the date is the missing value, an empty string is returned:
+
+  >>> ddc.toWidgetValue(None)
+  u''
+
 The converter only knows how to convert this particular format back to a
 datetime value:
 
@@ -240,7 +253,15 @@
   >>> ddc.toFieldValue(u'') is None
   True
 
+If the passed in string cannot be parsed, a formatter validation error is
+raised:
 
+  >>> ddc.toFieldValue(u'8.6.07')
+  Traceback (most recent call last):
+  ...
+  FormatterValidationError: ("The datetime string did not match the pattern
+                              u'yy/MM/dd'.", u'8.6.07')
+
 Time Data Converter
 -------------------
 



More information about the Checkins mailing list