web/views/forms.py
changeset 10016 984505da8b89
parent 10006 8391bf718485
child 10142 f4a4556f23da
--- a/web/views/forms.py	Wed Apr 09 16:58:58 2014 +0200
+++ b/web/views/forms.py	Thu Apr 25 10:16:25 2013 +0200
@@ -44,8 +44,11 @@
 
 __docformat__ = "restructuredtext en"
 
+
 from warnings import warn
 
+import time
+
 from logilab.common import dictattr, tempattr
 from logilab.common.decorators import iclassmethod, cached
 from logilab.common.textutils import splitstrip
@@ -349,7 +352,9 @@
         self.uicfg_affk = self._cw.vreg['uicfg'].select(
             'autoform_field_kwargs', self._cw, entity=self.edited_entity)
         self.add_hidden('__type', self.edited_entity.cw_etype, eidparam=True)
+
         self.add_hidden('eid', self.edited_entity.eid)
+        self.add_generation_time()
         # mainform default to true in parent, hence default to True
         if kwargs.get('mainform', True) or kwargs.get('mainentity', False):
             self.add_hidden(u'__maineid', self.edited_entity.eid)
@@ -363,6 +368,11 @@
             msgid = self._cw.set_redirect_message(msg)
             self.add_hidden('_cwmsgid', msgid)
 
+    def add_generation_time(self):
+        # NB repr is critical to avoid truncation of the timestamp
+        self.add_hidden('__form_generation_time', repr(time.time()),
+                        eidparam=True)
+
     def add_linkto_hidden(self):
         """add the __linkto hidden field used to directly attach the new object
         to an existing other one when the relation between those two is not