diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 1d539dd2..b872e736 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -603,8 +603,8 @@ class BatchMasterView(MasterView): # TODO execution_options_schema = None - def make_execute_schema(self): - return self.execution_options_schema() + def make_execute_schema(self, batch): + return self.execution_options_schema().bind(batch=batch) def make_execute_form(self, batch=None, **kwargs): """ @@ -616,11 +616,15 @@ class BatchMasterView(MasterView): if self.has_execution_options(batch): if batch is None: batch = self.model_class - schema = self.make_execute_schema() + schema = self.make_execute_schema(batch) for field in schema: - key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field.name) - if key in self.request.session: - defaults[field.name] = self.request.session[key] + + # if field does not yet have a default, maybe provide one from session storage + if field.default is colander.null: + key = 'batch.{}.execute_option.{}'.format(batch.batch_key, field.name) + if key in self.request.session: + defaults[field.name] = self.request.session[key] + else: schema = colander.Schema()