[Erp5-report] r23204 - /erp5/trunk/products/ERP5/Document/Alarm.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Aug 27 16:53:01 CEST 2008


Author: aurel
Date: Wed Aug 27 16:52:56 2008
New Revision: 23204

URL: http://svn.erp5.org?rev=23204&view=rev
Log:
- use id tool to generate activity tag. 
- when creating an active process from the alarm, reindex it with the
last tag from the alarm so that the notify activity will wait for it
to be reindexed. This will make notify retrieve the real last active process.

Modified:
    erp5/trunk/products/ERP5/Document/Alarm.py

Modified: erp5/trunk/products/ERP5/Document/Alarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Alarm.py?rev=23204&r1=23203&r2=23204&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Alarm.py (original)
+++ erp5/trunk/products/ERP5/Document/Alarm.py Wed Aug 27 16:52:56 2008
@@ -303,9 +303,11 @@
     if method_id not in (None, ''):
       # A tag is provided as a parameter in order to be
       # able to notify the user after all processes are ended
+      # Tag is generated from portal_ids so that it can be retrieved
+      # later when creating an active process for example
       # We do some inspection to keep compatibility
       # (because fixit and tag were not set previously)
-      tag='Alarm_activeSense_%s_%s' % (self.getId(), DateTime())
+      tag = str(self.portal_ids.generateNewLengthId(id_group=self.getId()))
       kw = {}
       method = getattr(self, method_id)
       name_list = method.func_code.co_varnames
@@ -499,15 +501,19 @@
 
   security.declareProtected(Permissions.ModifyPortalContent, 
                             'newActiveProcess')
-  def newActiveProcess(self, **kw):
+  def newActiveProcess(self, activate_kw={}, **kw):
     """
     We will create a new active process in order to store
     new results, then this process will be added to the list
     of processes
     """
+    tag = self.portal_ids.getLastLengthGeneratedId(id_group=self.getId())
+    if tag is not None:
+      activate_kw.setdefault('tag', str(tag))
     portal_activities = getToolByName(self,'portal_activities')
     active_process = portal_activities.newActiveProcess(start_date=DateTime(),
                                                         causality_value=self,
+                                                        activate_kw=activate_kw,
                                                         **kw)
     return active_process
 




More information about the Erp5-report mailing list