wuttaweb.views.batch¶
Base logic for Batch Master views
- class wuttaweb.views.batch.BatchMasterView(request, context=None)[source]¶
Base class for all “batch master” views.
- batch_handler¶
Reference to the batch handler for use with the view.
This is set when the view is first created, using return value from
get_batch_handler().
- create_row_save_form(form)[source]¶
Override of the parent method
create_row_save_form(); this does basically the same thing except it also will calladd_row()on the batch handler.
- delete_instance(obj)[source]¶
Delete the given batch instance.
This calls
do_delete()on thebatch_handler.
- execute()[source]¶
View to execute the current batch.
Eventually this should show a progress indicator etc., but for now it simply calls
do_execute()on thebatch_handlerand waits for it to complete, then redirects user back to the “view batch” page.
- get_batch_handler()[source]¶
Must return the batch handler for use with this view.
There is no default logic; subclass must override.
- get_fallback_templates(template)[source]¶
We override the default logic here, to prefer “batch” templates over the “master” templates.
So for instance the “view batch” page will by default use the
/batch/view.makotemplate - which does inherit from/master/view.makobut adds extra features specific to batches.
- get_row_parent(row)[source]¶
This overrides the parent method
get_row_parent()to return the batch to which the given row belongs.
- is_editable(batch)[source]¶
This overrides the parent method
is_editable()to returnFalseif the batch has already been executed.
- objectify(form, **kwargs)[source]¶
We override the default logic here, to invoke
make_batch()on the batch handler - when creating. Parent/default logic is used when updating.- Parameters:
**kwargs – Additional kwargs will be passed as-is to the
make_batch()call.
- populate_thread(batch_uuid, progress=None)[source]¶
Thread target for populating new object with progress indicator.
When a new batch is created, and the batch handler says it should also be populated, then this thread is launched to do so outside of the main request/response cycle. Progress bar is then shown to the user until it completes.
This method mostly just calls
do_populate()on the batch handler.
- redirect_after_create(obj)[source]¶
If the new batch requires initial population, we launch a thread for that and show the “progress” page.
Otherwise this will do the normal thing of redirecting to the “view” page for the new batch.
- render_to_response(template, context)[source]¶
We override the default logic here, to inject batch-related context for the
view()template specifically. These values are used in the template file,/batch/view.mako.batch- reference to the current batchbatch_handlerreference tobatch_handlerwhy_not_execute- text of reason (if any) not to execute batchexecution_described- HTML (rendered from markdown) describing batch execution