web/form.py
changeset 5358 d4d294610ee7
parent 5223 6abd6e3599f4
child 5385 b6e250dd7a7d
--- a/web/form.py	Tue Apr 20 16:31:53 2010 +0200
+++ b/web/form.py	Tue Apr 20 18:09:56 2010 +0200
@@ -117,14 +117,16 @@
     def form_valerror(self):
         """the validation error exception if any"""
         if self.parent_form is None:
-            return self._form_valerror
+            # unset if restore_previous_post has not be called
+            return getattr(self, '_form_valerror', None)
         return self.parent_form.form_valerror
 
     @property
     def form_previous_values(self):
         """previously posted values (on validation error)"""
         if self.parent_form is None:
-            return self._form_previous_values
+            # unset if restore_previous_post has not be called
+            return getattr(self, '_form_previous_values', {})
         return self.parent_form.form_previous_values
 
     @iclassmethod