force_session_key default to None in base form class... stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 18 Dec 2009 13:02:13 +0100
branchstable
changeset 4133 24ffe983abfc
parent 4132 440d383367eb
child 4134 40624a708dd4
force_session_key default to None in base form class...
web/views/forms.py
--- a/web/views/forms.py	Fri Dec 18 10:26:47 2009 +0100
+++ b/web/views/forms.py	Fri Dec 18 13:02:13 2009 +0100
@@ -293,14 +293,13 @@
         """return the key that may be used to store / retreive data about a
         previous post which failed because of a validation error
         """
-        try:
+        if self.force_session_key is not None:
             return self.force_session_key
-        except AttributeError:
-            # XXX if this is a json request, suppose we should redirect to the
-            # entity primary view
-            if self.req.json_request:
-                return '%s#%s' % (self.edited_entity.absolute_url(), self.domid)
-            return '%s#%s' % (self.req.url(), self.domid)
+        # XXX if this is a json request, suppose we should redirect to the
+        # entity primary view
+        if self.req.json_request:
+            return '%s#%s' % (self.edited_entity.absolute_url(), self.domid)
+        return '%s#%s' % (self.req.url(), self.domid)
 
     def _field_has_error(self, field):
         """return true if the field has some error in given validation exception