Allow batch execution to require options on a per-batch basis
plus some other changes i think..
This commit is contained in:
parent
98ca378302
commit
3477637c74
5 changed files with 26 additions and 15 deletions
|
@ -109,7 +109,7 @@ class BatchMasterView(MasterView):
|
|||
kwargs['handler'] = self.handler
|
||||
kwargs['execute_title'] = self.get_execute_title(batch)
|
||||
kwargs['execute_enabled'] = self.instance_executable(batch)
|
||||
if kwargs['execute_enabled'] and self.has_execution_options:
|
||||
if kwargs['execute_enabled'] and self.has_execution_options(batch):
|
||||
kwargs['rendered_execution_options'] = self.render_execution_options(batch)
|
||||
return kwargs
|
||||
|
||||
|
@ -118,7 +118,7 @@ class BatchMasterView(MasterView):
|
|||
|
||||
def template_kwargs_index(self, **kwargs):
|
||||
kwargs['execute_enabled'] = self.instance_executable(None)
|
||||
if kwargs['execute_enabled'] and self.has_execution_options:
|
||||
if kwargs['execute_enabled'] and self.has_execution_options():
|
||||
kwargs['rendered_execution_options'] = self.render_execution_options()
|
||||
return kwargs
|
||||
|
||||
|
@ -350,7 +350,7 @@ class BatchMasterView(MasterView):
|
|||
|
||||
if self.edit_with_rows:
|
||||
context['rows_grid'] = grid
|
||||
if context['execute_enabled'] and self.has_execution_options:
|
||||
if context['execute_enabled'] and self.has_execution_options(batch):
|
||||
context['rendered_execution_options'] = self.render_execution_options(batch)
|
||||
|
||||
return self.render_to_response('edit', context)
|
||||
|
@ -474,8 +474,7 @@ class BatchMasterView(MasterView):
|
|||
# TODO: deprecate/remove this
|
||||
return self.handler.refreshable and not batch.executed
|
||||
|
||||
@property
|
||||
def has_execution_options(self):
|
||||
def has_execution_options(self, batch=None):
|
||||
return bool(self.execution_options_schema)
|
||||
|
||||
# TODO
|
||||
|
@ -750,7 +749,7 @@ class BatchMasterView(MasterView):
|
|||
if self.request.method == 'POST':
|
||||
|
||||
kwargs = {}
|
||||
if self.has_execution_options:
|
||||
if self.has_execution_options(batch):
|
||||
form = self.make_execution_options_form(batch)
|
||||
assert form.validate() # TODO
|
||||
kwargs.update(form.data)
|
||||
|
@ -833,7 +832,7 @@ class BatchMasterView(MasterView):
|
|||
if self.request.method == 'POST':
|
||||
|
||||
kwargs = {}
|
||||
if self.has_execution_options:
|
||||
if self.has_execution_options():
|
||||
form = self.make_execution_options_form()
|
||||
if not form.validate():
|
||||
raise RuntimeError("Execution options form did not validate")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue