diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 61c893e9..7d6216d3 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -45,7 +45,7 @@ from sqlalchemy import orm from rattail.db import model, Session as RattailSession from rattail.db.util import short_session from rattail.threads import Thread -from rattail.util import load_object, prettify, simple_error +from rattail.util import prettify, simple_error from rattail.progress import SocketProgress import colander @@ -142,12 +142,13 @@ class BatchMasterView(MasterView): ``batch_key`` attribute of the main batch model class. """ # first try to figure out if config defines a factory class + app = rattail_config.get_app() model_class = cls.get_model_class() batch_key = model_class.batch_key - spec = rattail_config.get('rattail.batch', '{}.handler'.format(batch_key), - default=cls.default_handler_spec) - if spec: # yep, so use that - return load_object(spec) + handler = app.get_batch_handler(batch_key, + default=cls.default_handler_spec) + if handler: + return handler.__class__ # fall back to whatever class was defined statically return cls.batch_handler_class