[forms] fix RelationField bug with pending eids (eg inlined forms): we have to override process_form_value to avoid caching when recomputing is needed
--- a/web/formfields.py Mon Feb 15 15:17:24 2010 +0100
+++ b/web/formfields.py Mon Feb 15 15:18:38 2010 +0100
@@ -816,6 +816,18 @@
def format_single_value(self, req, value):
return value
+ def process_form_value(self, form):
+ """process posted form and return correctly typed value"""
+ try:
+ return form.formvalues[self]
+ except KeyError:
+ value = self._process_form_value(form)
+ # if value is None, there are some remaining pending fields, we'll
+ # have to recompute this later -> don't cache in formvalues
+ if value is not None:
+ form.formvalues[self] = value
+ return value
+
def _process_form_value(self, form):
"""process posted form and return correctly typed value"""
widget = self.get_widget(form)