[MERGE] OPW 581239: cron: fix _strptime import errors when multiple scheduled actions...
authorXavier ALT <xal@openerp.com>
Thu, 31 Jan 2013 09:21:45 +0000 (10:21 +0100)
committerXavier ALT <xal@openerp.com>
Thu, 31 Jan 2013 09:21:45 +0000 (10:21 +0100)
bzr revid: xal@openerp.com-20130131092145-1xt0f0zb3e2yzisa

1  2 
openerp/addons/base/ir/ir_cron.py

@@@ -240,7 -240,7 +240,12 @@@ class ir_cron(osv.osv)
                      if not acquired_lock:
                          # we're exiting due to an exception while acquiring the lot
                          task_cr.close()
 +
++                # Force call to strptime just before starting the cron thread
++                # to prevent time.strptime AttributeError within the thread.
++                # See: http://bugs.python.org/issue7980
+                 datetime.strptime('2012-01-01', '%Y-%m-%d')
++
                  # Got the lock on the job row, now spawn a thread to execute it in the transaction with the lock
                  task_thread = threading.Thread(target=self._run_job, name=job['name'], args=(task_cr, job, now))
                  # force non-daemon task threads (the runner thread must be daemon, and this property is inherited by default)