src/pyams_scheduler/task.py
changeset 37 1eb0c2098d47
parent 19 687d616d7dfb
child 41 0b31d2492f15
--- a/src/pyams_scheduler/task.py	Tue Jul 18 10:54:11 2017 +0200
+++ b/src/pyams_scheduler/task.py	Mon Sep 11 13:50:09 2017 +0200
@@ -40,7 +40,7 @@
 from apscheduler.triggers.base import BaseTrigger
 from persistent import Persistent
 from pyams_utils.date import get_duration
-from pyams_utils.registry import query_utility, get_utility
+from pyams_utils.registry import query_utility, get_utility, set_local_registry
 from pyams_utils.request import check_request
 from pyams_utils.timezone import tztime
 from pyams_utils.traversing import get_parent
@@ -109,6 +109,8 @@
     _history_duration = FieldProperty(ITask['history_duration'])
     _history_length = FieldProperty(ITask['history_length'])
 
+    settings_view_name = FieldProperty(ITask['settings_view_name'])
+
     _internal_id = None
 
     def __init__(self):
@@ -259,6 +261,7 @@
                     if not (kwargs.get('run_immediate') or task.is_runnable(registry)):
                         logger.debug("Skipping inactive task {0}".format(task.name))
                         return
+                    set_local_registry(sm)
                     tm = ITransactionManager(task)
                     for attempt in tm.attempts():
                         with attempt as t: