From 11d76d0db9924a3295176345a2057717c8355690 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 10 May 2016 18:48:10 +0200 Subject: [PATCH] Fix edit() for temporary objects created with Base.asContext For other temporary objects, there may be interactions on edit(), like Document_base_convertable_edit (document_conversion_interaction_workflow), tested by test_02_VolatileCacheConversionOfTempObject (testOOoConversionCache). --- product/ERP5Type/mixin/temporary.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/product/ERP5Type/mixin/temporary.py b/product/ERP5Type/mixin/temporary.py index e425f8b82b..7a1f6e5cdf 100644 --- a/product/ERP5Type/mixin/temporary.py +++ b/product/ERP5Type/mixin/temporary.py @@ -80,6 +80,14 @@ class TemporaryDocumentMixin(object): def getTitle(self): return getattr(self,'title',None) + def edit(self, *args, **kw): + if getattr(self, "_original", None) is None: + return super(TemporaryDocumentMixin, self).edit(*args, **kw) + # Object created with Base.asContext, so do not touch borrowed + # workflow history, in particular if it is persistent. + # This also avoids security issues. + return self._edit(restricted=1, *args, **kw) + # Make some methods public. for method_id in ('reindexObject', 'recursiveReindexObject', 'activate', 'setUid', 'setTitle', 'getTitle', -- 2.30.9