add view attribute to job manager
This commit is contained in:
parent
c9ee6d1aac
commit
7a48f12735
2 changed files with 11 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Base class(es) for job management.
|
Base class(es) for job management.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component, interface
|
from zope import component, interface
|
||||||
|
@ -33,6 +31,8 @@ class JobManager(object):
|
||||||
interface.implements(IJobManager)
|
interface.implements(IJobManager)
|
||||||
component.adapts(ILoops)
|
component.adapts(ILoops)
|
||||||
|
|
||||||
|
view = None # may be set by calling view
|
||||||
|
|
||||||
def __init__(self, context):
|
def __init__(self, context):
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,13 +18,12 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Definition of view classes and other browser related stuff for job management.
|
Definition of view classes and other browser related stuff for job management.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
from zope.security.proxy import removeSecurityProxy
|
||||||
|
|
||||||
from cybertools.meta.interfaces import IOptions
|
from cybertools.meta.interfaces import IOptions
|
||||||
from cybertools.organize.interfaces import IJobManager
|
from cybertools.organize.interfaces import IJobManager
|
||||||
|
@ -49,16 +48,20 @@ class Executor(object):
|
||||||
|
|
||||||
def processJobs(self):
|
def processJobs(self):
|
||||||
output = []
|
output = []
|
||||||
names = [n for n in self.request.get('job_managers', '').split(',') if n]
|
names = [n for n in self.request.get('job_managers', '').split(',')
|
||||||
|
if n]
|
||||||
if not names:
|
if not names:
|
||||||
names = self.options('organize.job.managers', [])
|
names = self.options('organize.job.managers', [])
|
||||||
for name in names:
|
for name in names:
|
||||||
manager = component.queryAdapter(self.context, IJobManager, name=name)
|
manager = component.queryAdapter(self.context, IJobManager,
|
||||||
|
name=name)
|
||||||
if manager is None:
|
if manager is None:
|
||||||
msg = "Job manager '%s' not found." % name
|
msg = "Job manager '%s' not found." % name
|
||||||
self.logger.warn(msg)
|
self.logger.warn(msg)
|
||||||
output.append(msg)
|
output.append(msg)
|
||||||
else:
|
else:
|
||||||
|
manager = removeSecurityProxy(manager)
|
||||||
|
manager.view = self
|
||||||
output.append(manager.process())
|
output.append(manager.process())
|
||||||
if not output:
|
if not output:
|
||||||
return 'No job managers available.'
|
return 'No job managers available.'
|
||||||
|
|
Loading…
Add table
Reference in a new issue