restore possibility to have default value methods on forms, this may still be useful according to how the form is defined
--- a/web/form.py Tue May 19 09:05:47 2009 +0200
+++ b/web/form.py Tue May 19 09:06:42 2009 +0200
@@ -378,10 +378,10 @@
def form_field_value(self, field, load_bytes=False):
"""return field's *typed* value"""
- value = field.initial
- if callable(value):
- value = value(self)
- return value
+ myattr = '%s_%s_default' % (field.role, field.name)
+ if hasattr(self, myattr):
+ return getattr(self, myattr)()
+ return field.initial
def form_field_error(self, field):
"""return validation error for widget's field, if any"""