[views/workflow/tmppng] fix console crash on nth call to this one-shot view stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 02 Jan 2014 18:30:31 +0100
branchstable
changeset 9426 8e87f1e18a37
parent 9425 d7e8293fa4de
child 9427 9c13ebd45cb6
[views/workflow/tmppng] fix console crash on nth call to this one-shot view The underlying design issue is not addressed here, only a cosmetic and "we understand and document what's happening" note. Related to #3400448.
web/views/workflow.py
--- a/web/views/workflow.py	Tue Dec 10 11:44:06 2013 +0000
+++ b/web/views/workflow.py	Thu Jan 02 18:30:31 2014 +0100
@@ -442,6 +442,13 @@
     binary = True
 
     def cell_call(self, row=0, col=0):
-        tmpfile = self._cw.session.data[self._cw.form['tmpfile']]
+        key = self._cw.form['tmpfile']
+        if key not in self._cw.session.data:
+            # the temp file is gone and there's nothing
+            # we can do about it
+            # we should probably write it to some well
+            # behaved place and serve it
+            return
+        tmpfile = self._cw.session.data.pop(key)
         self.w(open(tmpfile, 'rb').read())
         os.unlink(tmpfile)