|
From: <sub...@co...> - 2007-10-21 00:25:34
|
Author: ianb
Date: 2007-10-20 18:25:36 -0600 (Sat, 20 Oct 2007)
New Revision: 3103
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/schema.py
Log:
Add missing message for missing fields
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2007-10-21 00:23:37 UTC (rev 3102)
+++ FormEncode/trunk/docs/news.txt 2007-10-21 00:25:36 UTC (rev 3103)
@@ -43,6 +43,10 @@
* Make ``validators.DateConverter`` serialize dates properly (from
James Gardner).
+* You can control the missing message (which by default is just
+ "Missing Value") using the message ``"missing"`` in a validator
+ (also from James Gardner).
+
* Minor fix to setup.py to make FormEncode more friendly with
zc.buildout.
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2007-10-21 00:23:37 UTC (rev 3102)
+++ FormEncode/trunk/formencode/schema.py 2007-10-21 00:25:36 UTC (rev 3103)
@@ -159,9 +159,11 @@
if self.ignore_key_missing:
continue
if self.if_key_missing is NoDefault:
- errors[name] = Invalid(
- self.message('missingValue', state),
- None, state)
+ try:
+ message = validator.message('missing', state)
+ except KeyError:
+ message = self.message('missingValue', state)
+ errors[name] = Invalid(message, None, state)
else:
try:
new[name] = validator.to_python(self.if_key_missing, state)
|