Author: ianb
Date: 2008-09-18 17:58:45 -0600 (Thu, 18 Sep 2008)
New Revision: 3593
Modified:
FormEncode/trunk/formencode/foreach.py
Log:
Make ForEach(if_missing=None) work (previous commit had made it unsettable)
Modified: FormEncode/trunk/formencode/foreach.py
===================================================================
--- FormEncode/trunk/formencode/foreach.py 2008-09-18 18:16:52 UTC (rev
3592)
+++ FormEncode/trunk/formencode/foreach.py 2008-09-18 23:58:45 UTC (rev
3593)
@@ -43,6 +43,7 @@
convert_to_list = True
if_empty = NoDefault
repeating = True
+ _if_missing = NoDefault
def attempt_convert(self, value, state, validate):
if self.convert_to_list:
@@ -111,10 +112,19 @@
def empty_value(self, value):
return []
- @property
- def if_missing(self):
- return []
+ def _if_missing__get(self):
+ if self._if_missing is NoDefault:
+ return []
+ return self._if_missing
+ def _if_missing__set(self, value):
+ self._if_missing = value
+
+ def _if_missing__del(self):
+ self._if_missing = NoDefault
+
+ if_missing = property(_if_missing__get, _if_missing__set, _if_missing__del)
+
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