[Checkins] SVN: Sandbox/gotcha/five.taskqueue/trunk/ Avoid code to stop thread and set the default value for variable before exception

Jean-Francois Roche jfroche at jfroche.be
Mon May 16 08:59:57 EDT 2011


Log message for revision 121671:
  Avoid code to stop thread and set the default value for variable before exception

Changed:
  U   Sandbox/gotcha/five.taskqueue/trunk/docs/HISTORY.txt
  U   Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py

-=-
Modified: Sandbox/gotcha/five.taskqueue/trunk/docs/HISTORY.txt
===================================================================
--- Sandbox/gotcha/five.taskqueue/trunk/docs/HISTORY.txt	2011-05-16 08:31:33 UTC (rev 121670)
+++ Sandbox/gotcha/five.taskqueue/trunk/docs/HISTORY.txt	2011-05-16 12:59:57 UTC (rev 121671)
@@ -4,7 +4,7 @@
 0.1-alpha-3 (unreleased)
 ------------------------
 
-- Nothing changed yet.
+- Avoid code to stop thread and set the default value for variable before exception
 
 
 0.1-alpha-2 (2010-10-19)

Modified: Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py
===================================================================
--- Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py	2011-05-16 08:31:33 UTC (rev 121670)
+++ Sandbox/gotcha/five.taskqueue/trunk/src/five/taskqueue/processor.py	2011-05-16 12:59:57 UTC (rev 121671)
@@ -30,15 +30,15 @@
         request = HTTPRequest(None, env, response)
         request.args = args
         conn = self.db.open()
-        root = conn.root()
-        request['PARENTS'] = [root['Application']]
+        result = ''
         try:
             try:
+                root = conn.root()
+                request['PARENTS'] = [root['Application']]
                 ZPublisher.Publish.publish(request, 'Zope2', [None])
                 result = request.response.body
             except NotFound, error:
                 log.warning('NotFound when traversing to %s' % '/'.join(path))
-                result = ''
             except Exception, error:
                 # This thread should never crash, thus a blank except
                 log.error('Processor: ``%s()`` caused an error!' % method)



More information about the checkins mailing list