Skip to content

/ Zope / gocept svn checkins / Archive / 2006 / 2006-06 / SVN: r4116 - AlphaFlow/trunk

[ << ] [ >> ]

[ SVN: r4112 - lms/trunk/lib/python/lms / Christian ... ] [ SVN: r4123 - ZopeDeSkin / Roman Joost ... ]

SVN: r4116 - AlphaFlow/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 13:24:24 [ FULL ]
Author: zagy
Date: Tue Jun  6 13:24:20 2006
New Revision: 4116

Modified:
   AlphaFlow/trunk/rolecache.py
Log:
zope 2.7 compatibility

Modified: AlphaFlow/trunk/rolecache.py
==============================================================================
--- AlphaFlow/trunk/rolecache.py	(original)
+++ AlphaFlow/trunk/rolecache.py	Tue Jun  6 13:24:20 2006
(at)(at) -134,7 +134,7 (at)(at)
 
         content_user_roles = {}
         for wi in self._instance_workitem_cache.get(instance_id, {}).keys():
-            if wi not in workitem_role_cache:
+            if not workitem_role_cache.has_key(wi):
                 continue
 
             activity = instance[wi].getActivity()

SVN: r4117 - AlphaFlow/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 13:44:03 [ FULL ]
Author: zagy
Date: Tue Jun  6 13:43:58 2006
New Revision: 4117

Modified:
   AlphaFlow/trunk/eventchannel.py
Log:
only updating cache when not called from it

Modified: AlphaFlow/trunk/eventchannel.py
==============================================================================
--- AlphaFlow/trunk/eventchannel.py	(original)
+++ AlphaFlow/trunk/eventchannel.py	Tue Jun  6 13:43:58 2006
(at)(at) -2,6 +2,8 (at)(at)
 # See also LICENSE.txt
 # $Id$
 
+from traceback import extract_stack
+
 from AccessControl import ClassSecurityInfo
 from Interface import Interface
 from OFS.SimpleItem import SimpleItem
(at)(at) -100,10 +102,23 (at)(at)
     meta_type = config.mtAllowedRolesAndUsersProxy
 
     def index_object(self, documentId, obj, threshold=None):
-        alf = getToolByName(self, 'workflow_manager')
-        alf.updateCacheByContent(obj)
+        if not self._called_from_cache():
+            alf = getToolByName(self, 'workflow_manager')
+            alf.updateCacheByContent(obj)
 
         return AllowedRolesAndUsersProxy.inheritedAttribute('index_object')(
             self, documentId, obj, threshold)
 
 
+    def _called_from_cache(self):
+        stack = extract_stack()
+        stack.reverse()  # innermost first
+        for (filename, line_number, function_name, text) in stack:
+            if function_name == 'updateCacheByWorkItem':
+                return True
+            elif function_name == 'updateCacheByInstance':
+                return True
+
+        return False
+
+

SVN: r4118 - AlphaFlow/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 13:55:40 [ FULL ]
Author: zagy
Date: Tue Jun  6 13:55:38 2006
New Revision: 4118

Modified:
   AlphaFlow/trunk/processmanager.py
Log:
threadlock around pingCronItems
pingCronItems commits after each pinged workitem

Modified: AlphaFlow/trunk/processmanager.py
==============================================================================
--- AlphaFlow/trunk/processmanager.py	(original)
+++ AlphaFlow/trunk/processmanager.py	Tue Jun  6 13:55:38 2006
(at)(at) -5,6 +5,7 (at)(at)
 
 # Python imports
 import sys
+from threading import Lock
 
 try:
   import libxml2
(at)(at) -42,6 +43,7 (at)(at)
 from Products.AlphaFlow.rolecache import RoleCache
 
 _marker = object()
+ping_lock = Lock()
 
 class ProcessManager(RoleCache, UniqueObject, ActionProviderBase, Folder):
     """A process management object."""
(at)(at) -365,21 +367,29 (at)(at)
         """Check if there are pending alarmworkitems which should be
            triggered.
         """
-        workflow_catalog = getToolByName(self, "workflow_catalog")
-        
-        # get all AlarmWorkItems
-        brains = workflow_catalog(activity_type="alarm", state="active")
-        
-        workitems = [ x.getObject() for x in brains ]
-        
-        # try to trigger them
-        for item in workitems:
-            try:
-                item.trigger_workitem()
-            except Exception:
-                info = sys.exc_info()
-                item.changeState('fallout', 'Fallout on calling
trigger_workitem', info)
-                getToolByName(self, 'error_log').raising(info)
+        locked = ping_lock.acquire(False)
+        if not locked:
+            return "Ping already running"
+
+        try:  
+            workflow_catalog = getToolByName(self, "workflow_catalog")
+            
+            # get all AlarmWorkItems
+            brains = workflow_catalog(activity_type="alarm", state="active")
+            
+            workitems = [ x.getObject() for x in brains ]
+            
+            # try to trigger them
+            for item in workitems:
+                try:
+                    item.trigger_workitem()
+                except Exception:
+                    info = sys.exc_info()
+                    item.changeState('fallout', 'Fallout on calling
trigger_workitem', info)
+                    getToolByName(self, 'error_log').raising(info)
+                get_transaction().commit()
+        finally:
+            ping_lock.release()
 
     security.declareProtected(config.MANAGE_WORKFLOW, 'restartHelper')
     def restartHelper(self, activityandprocess, REQUEST=None):

SVN: r4119 - AlphaFlow/trunk/activities
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 14:05:13 [ FULL ]
Author: zagy
Date: Tue Jun  6 14:05:11 2006
New Revision: 4119

Modified:
   AlphaFlow/trunk/activities/dcworkflow.py
Log:
fixed class naming

Modified: AlphaFlow/trunk/activities/dcworkflow.py
==============================================================================
--- AlphaFlow/trunk/activities/dcworkflow.py	(original)
+++ AlphaFlow/trunk/activities/dcworkflow.py	Tue Jun  6 14:05:11 2006
(at)(at) -17,7 +17,7 (at)(at)
 from Products.AlphaFlow.workflowattr import WorkflowAttribute
 
 
-class WorkFlowHistoryFake(dict):
+class WorkflowHistoryFake(dict):
 
     def __setitem__(self, key, value):
         if key != "alphaflow_fake":

SVN: r4120 - AlphaFlow/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 16:44:35 [ FULL ]
Author: zagy
Date: Tue Jun  6 16:44:31 2006
New Revision: 4120

Modified:
   AlphaFlow/trunk/workitem.py
Log:
be more smart with notifyassigneeschange

Modified: AlphaFlow/trunk/workitem.py
==============================================================================
--- AlphaFlow/trunk/workitem.py	(original)
+++ AlphaFlow/trunk/workitem.py	Tue Jun  6 16:44:31 2006
(at)(at) -576,6 +576,14 (at)(at)
         """Checks if this workitem is relevant to this user."""
         return False # Automatic
 
+
+    security.declarePrivate("notifyAssigneesChange")
+    def notifyAssigneesChange(self):
+        """notifies the workitem that the assignees might have changed
+        """
+        # we are automatic. The assignees never ever change. Thus we do
nothing
+        pass
+
     security.declarePrivate("onStart")
     def onStart(self):
         """Runs the automatic procedure, handles exceptions and moves on."""

SVN: r4121 - AlphaFlow/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 16:45:11 [ FULL ]
Author: zagy
Date: Tue Jun  6 16:45:09 2006
New Revision: 4121

Modified:
   AlphaFlow/trunk/workitem.py
Log:
fixed Id-kw

Modified: AlphaFlow/trunk/workitem.py
==============================================================================
--- AlphaFlow/trunk/workitem.py	(original)
+++ AlphaFlow/trunk/workitem.py	Tue Jun  6 16:45:09 2006
(at)(at) -1,6 +1,6 (at)(at)
 # Copyright (c) 2004-2006 gocept gmbh & co. kg
 # See also LICENSE.txt
-# workitem.py,v 1.57.2.3 2005/05/02 10:08:51 zagy Exp
+# $Id$
 """Workitem definitions"""
 
 # Python imports

SVN: r4122 - AlphaFlow/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-06 16:46:15 [ FULL ]
Author: zagy
Date: Tue Jun  6 16:46:13 2006
New Revision: 4122

Modified:
   AlphaFlow/trunk/processmanager.py
Log:
commiting transaction after each object in restartHelper

Modified: AlphaFlow/trunk/processmanager.py
==============================================================================
--- AlphaFlow/trunk/processmanager.py	(original)
+++ AlphaFlow/trunk/processmanager.py	Tue Jun  6 16:46:13 2006
(at)(at) -413,6 +413,7 (at)(at)
             # Restart it
             workitem.changeState("active", "Automatic restart by restart
helper.")
             restarted += 1
+            get_transaction().commit()
 
         if REQUEST is not None:
             REQUEST.RESPONSE.redirect(self.absolute_url() +

SVN: r4162 - AlphaFlow/trunk/activities
Christian Zagrodnick <cz(at)gocept.com>
2006-06-13 14:29:14 [ FULL ]
Author: zagy
Date: Tue Jun 13 14:29:45 2006
New Revision: 4162

Modified:
   AlphaFlow/trunk/activities/dcworkflow.py
Log:
renamed workflowhistoryfake

Modified: AlphaFlow/trunk/activities/dcworkflow.py
==============================================================================
--- AlphaFlow/trunk/activities/dcworkflow.py	(original)
+++ AlphaFlow/trunk/activities/dcworkflow.py	Tue Jun 13 14:29:45 2006
(at)(at) -21,10 +21,10 (at)(at)
 
     def __setitem__(self, key, value):
         if key != "alphaflow_fake":
-            super(WorkFlowHistoryFake, self).__setitem__(key, value)
+            super(WorkflowHistoryFake, self).__setitem__(key, value)
 
     def set(self, key, value):
-        super(WorkFlowHistoryFake, self).__setitem__(key, value)
+        super(WorkflowHistoryFake, self).__setitem__(key, value)
 
 
 class DCWorkFlowActivity(BaseAutomaticActivity):
(at)(at) -63,8 +63,8 (at)(at)
         ob = self.getContentObject()
         act = self.getActivity()
         wfh = getattr(ob, "workflow_history", {})
-        if type(wfh) is not WorkFlowHistoryFake:
-            wfh = ob.workflow_history = WorkFlowHistoryFake(wfh)
+        if type(wfh) is not WorkflowHistoryFake:
+            wfh = ob.workflow_history = WorkflowHistoryFake(wfh)
             wfh["alphaflow_fake"] = ()
         affh = list(wfh.get("alphaflow_fake", ()))
         affh.append({

SVN: r4174 - Formulon/trunk
Thomas Lotze <tl(at)gocept.com>
2006-06-21 13:39:08 [ FULL ]
Author: thomas
Date: Wed Jun 21 11:45:23 2006
New Revision: 4174

Modified:
   Formulon/trunk/WidgetBase.py
Log:
added __nonzero__ and __str__ methods to the HiddenField class

Modified: Formulon/trunk/WidgetBase.py
==============================================================================
--- Formulon/trunk/WidgetBase.py	(original)
+++ Formulon/trunk/WidgetBase.py	Wed Jun 21 11:45:23 2006
(at)(at) -41,7 +41,12 (at)(at)
             return None
 
 class HiddenField:
-    pass
+
+    def __nonzero__(self):
+        return False
+
+    def __str__(self):
+        return ""
 
 class TALESMethod(Persistent, Acquisition.Implicit):
     """A method object; calls method name in acquisition context.

SVN: r4193 - LeuBsm/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-29 20:50:37 [ FULL ]
Author: zagy
Date: Thu Jun 29 20:50:27 2006
New Revision: 4193

Modified:
   LeuBsm/trunk/niveau.py
Log:
creation date speichern

Modified: LeuBsm/trunk/niveau.py
==============================================================================
--- LeuBsm/trunk/niveau.py	(original)
+++ LeuBsm/trunk/niveau.py	Thu Jun 29 20:50:27 2006
(at)(at) -165,6 +165,9 (at)(at)
         self.Schema().get('school').set(self, value)
         self._set_reviewers()
 
+    
+    def setCreationDate(self, value):
+        self.creation_date = value
 
     # local role support

SVN: r4194 - LeuBsm/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-30 13:34:52 [ FULL ]
Author: zagy
Date: Fri Jun 30 13:34:48 2006
New Revision: 4194

Modified:
   LeuBsm/trunk/downloadviews.py
Log:
different view perm

Modified: LeuBsm/trunk/downloadviews.py
==============================================================================
--- LeuBsm/trunk/downloadviews.py	(original)
+++ LeuBsm/trunk/downloadviews.py	Fri Jun 30 13:34:48 2006
(at)(at) -184,6 +184,10 (at)(at)
     schema = downloadSchoolSubjectViewSchema
 
     security = ClassSecurityInfo()
+    view_persmission_map = {
+        config.mtExample: VIEW_EXAMPLE_PERMISSION,
+        config.mtNiveau: VIEW_CONTENT_PERMISSION,
+    }
 
     global_allow = 0
     actions = ({
(at)(at) -206,6 +210,7 (at)(at)
         subject = self.getSchoolSubject()
         user = getSecurityManager().getUser()
         view_type = self.getDownloadView().getMaterialType()
+        view_permission = self.view_persmission_map[view_type]
 
         if subject is None:
             examples = []
(at)(at) -215,7 +220,7 (at)(at)
             # Filter by permission
             examples = [example for example in examples
                         if example.portal_type == view_type
-                        if user.has_permission(VIEW_CONTENT_PERMISSION,
+                        if user.has_permission(view_persmission,
                                                example)]
         
         return examples

SVN: r4195 - LeuBsm/trunk
Christian Zagrodnick <cz(at)gocept.com>
2006-06-30 13:42:32 [ FULL ]
Author: zagy
Date: Fri Jun 30 13:42:31 2006
New Revision: 4195

Modified:
   LeuBsm/trunk/downloadviews.py
Log:
typo

Modified: LeuBsm/trunk/downloadviews.py
==============================================================================
--- LeuBsm/trunk/downloadviews.py	(original)
+++ LeuBsm/trunk/downloadviews.py	Fri Jun 30 13:42:31 2006
(at)(at) -219,8 +219,9 (at)(at)
                         subject.getBRefs('primarySubject'))
             # Filter by permission
             examples = [example for example in examples
+                        if example is not None
                         if example.portal_type == view_type
-                        if user.has_permission(view_persmission,
+                        if user.has_permission(view_permission,
                                                example)]
         
         return examples

MailBoxer