[Erp5-report] r8067 - /spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jun 19 18:52:46 CEST 2006
Author: kevin
Date: Mon Jun 19 18:52:42 2006
New Revision: 8067
URL: http://svn.erp5.org?rev=8067&view=rev
Log:
Don't let TimerService crash when the ERP5Site is not yet existing. This case append when we create a new Portal: At that step Timer Service start to 'ping' the portal before the zope transaction in which the portal is created is commited.
Modified:
spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch
Modified: spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch
URL: http://svn.erp5.org/spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch?rev=8067&r1=8066&r2=8067&view=diff
==============================================================================
--- spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch (original)
+++ spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch Mon Jun 19 18:52:42 2006
@@ -1,6 +1,13 @@
---- TimerService-0.2/TimerService/timerserver/TimerServer.py 2004-03-17 11:59:42.000000000 +0100
-+++ TimerService-0.2.patched/TimerService/timerserver/TimerServer.py 2006-03-01 16:39:53.000000000 +0100
-@@ -6,7 +6,7 @@
+diff -Naur TimerService-0.2.orig/TimerService/timerserver/TimerServer.py TimerService-0.2/TimerService/timerserver/TimerServer.py
+--- TimerService-0.2.orig/TimerService/timerserver/TimerServer.py 2004-03-17 11:59:42.000000000 +0100
++++ TimerService-0.2/TimerService/timerserver/TimerServer.py 2006-06-19 18:45:58.728147472 +0200
+@@ -1,12 +1,12 @@
+ # -*- coding: UTF-8 -*-
+ # -*- Mode: Python; py-indent-offset: 4 -*-
+-# Authors: Nik Kim <fafhrd at legco.biz>
++# Authors: Nik Kim <fafhrd at legco.biz>
+ __version__ = 'TimerServer for Zope 0.1'
+
import traceback
import thread
@@ -52,10 +59,23 @@
module = self.module
interval = self.interval
---- TimerService-0.2/TimerService/TimerService.py 2004-03-17 12:22:52.000000000 +0100
-+++ TimerService-0.2.patched/TimerService/TimerService.py 2006-03-01 16:51:02.000000000 +0100
-@@ -3,7 +3,7 @@
- # Authors: Nik Kim <fafhrd at legco.biz>
+@@ -67,7 +96,7 @@
+
+ def unauthorized(self):
+ pass
+-
++
+
+ class TimerRequest(HTTPRequest):
+
+diff -Naur TimerService-0.2.orig/TimerService/TimerService.py TimerService-0.2/TimerService/TimerService.py
+--- TimerService-0.2.orig/TimerService/TimerService.py 2004-03-17 12:22:52.000000000 +0100
++++ TimerService-0.2/TimerService/TimerService.py 2006-06-19 18:48:45.974722128 +0200
+@@ -1,9 +1,9 @@
+ # -*- coding: UTF-8 -*-
+ # -*- Mode: Python; py-indent-offset: 4 -*-
+-# Authors: Nik Kim <fafhrd at legco.biz>
++# Authors: Nik Kim <fafhrd at legco.biz>
__version__ = '$Revision: 1.3 $'[11:-2]
-import sys, time
@@ -72,29 +92,60 @@
class TimerService(SimpleItem):
""" timer service, all objects that wants timer
event subscribe here """
-@@ -49,6 +51,12 @@
+@@ -28,7 +30,7 @@
+ icon = 'misc_/TimerService/timer_icon.gif'
+
+ max_size = 0
+-
++
+ manage_options = (
+ ({'label': 'Subscribers', 'action':'manage_viewSubscriptions'},))
+
+@@ -39,9 +41,9 @@
+ globals(),
+ __name__='manage_viewSubscriptions'
+ )
+-
++
+ _version = 0
+-
++
+ def __init__(self, id='timer_service'):
+ """ """
+ self._subscribers = []
+@@ -49,15 +51,27 @@
def process_timer(self, interval):
""" """
+- subscriptions = [self.unrestrictedTraverse(path)
+- for path in self._subscribers]
+ # Try to acquire a lock, to make sure we only run one processing at a
+ # time, and abort if another processing is currently running
+ acquired = processing_lock.acquire(0)
+ if not acquired:
+ return
+
- subscriptions = [self.unrestrictedTraverse(path)
- for path in self._subscribers]
-
-@@ -56,7 +64,7 @@
++ # Don't let TimerService crash when the ERP5Site is not yet existing.
++ # This case append when we create a new Portal: At that step Timer Service start
++ # to 'ping' the portal before the zope transaction in which the portal is
++ # created is commited.
++ subscriptions = []
++ try:
++ subscriptions = [self.unrestrictedTraverse(path)
++ for path in self._subscribers]
++ except KeyError:
++ pass
+
+ tick = time.time()
prev_tick = tick - interval
next_tick = tick + interval
- LOG('TimerService', INFO, 'Ttimer tick at %s\n'%time.ctime(tick))
-+# LOG('TimerService', INFO, 'Ttimer tick at %s\n'%time.ctime(tick))
-
+-
for subscriber in subscriptions:
try:
-@@ -65,6 +73,9 @@
+ subscriber.process_timer(
+@@ -65,18 +79,24 @@
except:
LOG('TimerService', ERROR, 'Process timer error', error = sys.exc_info())
@@ -104,7 +155,12 @@
def subscribe(self, ob):
""" """
path = '/'.join(ob.getPhysicalPath())
-@@ -77,6 +88,12 @@
+
+- #if not ISMTPHandler.isImplementedBy(ob):
+- # raise ValueError, 'Object not support ISMTPHandler'
+-
+ subscribers = self._subscribers
+ if path not in subscribers:
subscribers.append(path)
self._subscribers = subscribers
@@ -117,7 +173,16 @@
def unsubscribe(self, ob):
""" """
path = '/'.join(ob.getPhysicalPath())
-@@ -94,12 +111,12 @@
+@@ -85,7 +105,7 @@
+ if path in subscribers:
+ subscribers.remove(path)
+ self._subscribers = subscribers
+-
++
+ security.declareProtected(
+ Permissions.view_management_screens, 'lisSubscriptions')
+ def lisSubscriptions(self):
+@@ -94,12 +114,12 @@
def manage_removeSubscriptions(self, no, REQUEST=None):
""" """
More information about the Erp5-report
mailing list