--- a/src/pyams_scheduler/interfaces/__init__.py Tue Jul 18 10:54:11 2017 +0200
+++ b/src/pyams_scheduler/interfaces/__init__.py Mon Sep 11 13:50:09 2017 +0200
@@ -199,6 +199,10 @@
class ITask(ITaskInfo, IAttributeAnnotatable):
"""Complete task interface"""
+ settings_view_name = TextLine(title=_("Settings view name"),
+ default='settings.html',
+ required=False)
+
history = List(title=_("History"),
description=_("Task history"),
value_type=Object(schema=ITaskHistory))
--- 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:
--- a/src/pyams_scheduler/zmi/scheduler.py Tue Jul 18 10:54:11 2017 +0200
+++ b/src/pyams_scheduler/zmi/scheduler.py Mon Sep 11 13:50:09 2017 +0200
@@ -117,13 +117,23 @@
icon_class = 'fa fa-fw fa-edit'
icon_hint = _("Task settings")
- url = 'settings.html'
target = None
modal_target = True
permission = MANAGE_SYSTEM_PERMISSION
weight = 1
+ def get_url(self, item):
+ url = item.settings_view_name
+ if url:
+ return absolute_url(item, self.request, url)
+
+ def renderCell(self, item):
+ if item.settings_view_name:
+ return super(SchedulerTasksSettingsColumn, self).renderCell(item)
+ else:
+ return ''
+
@adapter_config(name='scheduler', context=(Interface, IAdminLayer, SchedulerTasksTable), provides=IColumn)
class SchedulerTasksScheduleColumn(ActionColumn):
@@ -230,7 +240,6 @@
"""Scheduler tasks header adapter"""
icon_class = 'fa fa-fw fa-clock-o'
- title = _("Control panel")
subtitle = _("Tasks scheduler")