Author: ianb
Date: 2008-09-10 10:13:50 -0600 (Wed, 10 Sep 2008)
New Revision: 3576
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/foreach.py
Log:
fix ForEach.if_missing to make it an empty-list factory
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-09-10 11:47:48 UTC (rev 3575)
+++ FormEncode/trunk/docs/news.txt 2008-09-10 16:13:50 UTC (rev 3576)
@@ -29,6 +29,11 @@
* :class:`formencode.compound.All` does not handle empty values,
instead relying on sub-validators to check for emptiness.
+* Fixed the ``if_missing`` attribute in
+ :class:`formencode.foreach.ForEach`; previously it would be the same
+ list instance, so if you modified it then it would effect future
+ ``if_missing`` values (reported by Felix Schwarz).
+
1.0.1
-----
Modified: FormEncode/trunk/formencode/foreach.py
===================================================================
--- FormEncode/trunk/formencode/foreach.py 2008-09-10 11:47:48 UTC (rev
3575)
+++ FormEncode/trunk/formencode/foreach.py 2008-09-10 16:13:50 UTC (rev
3576)
@@ -42,7 +42,6 @@
convert_to_list = True
if_empty = NoDefault
- if_missing = []
repeating = True
def attempt_convert(self, value, state, validate):
@@ -112,6 +111,10 @@
def empty_value(self, value):
return []
+ @property
+ def if_missing(self):
+ return []
+
def _convert_to_list(self, value):
if isinstance(value, (str, unicode)):
return [value]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FormEncode-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs