From 2d94e28cd7ed6c871e3dcfacddbd589bef022b79 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 30 Apr 2010 11:03:31 +0000
Subject: [PATCH] Move the return BaiseTool.newContent for temporary objects
 later in order to initialise some variables like portal_type and filename to
 ease the creation of temporary object. Without this patch, the first
 portal_type of allowed_content_type of portal_contribution is used.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34888 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/ContributionTool.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/Tool/ContributionTool.py b/product/ERP5/Tool/ContributionTool.py
index 65a68db76a..10f9314737 100644
--- a/product/ERP5/Tool/ContributionTool.py
+++ b/product/ERP5/Tool/ContributionTool.py
@@ -135,10 +135,6 @@ class ContributionTool(BaseTool):
       # we can pass file as parameter to ZPublisher
       # whenever we ingest email
       kw['data'] = data
-    # Temp objects use the standard newContent from Folder
-    if temp_object:
-      # For temp_object creation, use the standard method
-      return BaseTool.newContent(self, id=id, portal_type=portal_type, temp_object=1, **kw)
 
     document = None
 
@@ -226,6 +222,11 @@ class ContributionTool(BaseTool):
           document.edit(file=kw['file'])
           return document
 
+    # Temp objects use the standard newContent from Folder
+    if temp_object:
+      # For temp_object creation, use the standard method
+      return BaseTool.newContent(self, id=id, portal_type=portal_type, temp_object=1, **kw)
+
     # Then put the file inside ourselves for a short while
     if container_path is not None:
       container = self.getPortalObject().restrictedTraverse(container_path)
-- 
2.30.9