[Erp5-report] r42919 nicolas.dumazet - /erp5/trunk/products/CMFActivity/ActivityTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Feb 2 06:19:51 CET 2011


Author: nicolas.dumazet
Date: Wed Feb  2 06:19:51 2011
New Revision: 42919

URL: http://svn.erp5.org?rev=42919&view=rev
Log:
create Active Process using newContent to make sure that the active process
has accessors. If we dont do this, the object has no accessors and is useless
as a context.

Note that the previous generateNewId() call was exactly as harmful as this code,
as generateNewId() needs properties and accessors from ERP5, and can't be
reasonably be decoupled from ERP5

Modified:
    erp5/trunk/products/CMFActivity/ActivityTool.py

Modified: erp5/trunk/products/CMFActivity/ActivityTool.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/ActivityTool.py?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/ActivityTool.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/ActivityTool.py [utf8] Wed Feb  2 06:19:51 2011
@@ -1424,10 +1424,13 @@ class ActivityTool (Folder, UniqueObject
       return message_count
 
     security.declareProtected( CMFCorePermissions.ManagePortal , 'newActiveProcess' )
-    def newActiveProcess(self, **kw):
-      from ActiveProcess import addActiveProcess
-      new_id = str(self.generateNewId())
-      return addActiveProcess(self, new_id, **kw)
+    def newActiveProcess(self, REQUEST=None, **kw):
+      # note: if one wants to create an Actice Process without ERP5 products,
+      # she can call ActiveProcess.addActiveProcess
+      obj = self.newContent(portal_type="Active Process", **kw)
+      if REQUEST is not None:
+        REQUEST['RESPONSE'].redirect( 'manage_main' )
+      return obj
 
     # Active synchronisation methods
     security.declarePrivate('validateOrder')



More information about the Erp5-report mailing list