Move get_batch_kwargs()
to BatchMasterView
This commit is contained in:
parent
d9145e5122
commit
339f3c6361
|
@ -265,6 +265,20 @@ class BatchMasterView(MasterView):
|
||||||
# return this object to replace the original
|
# return this object to replace the original
|
||||||
return batch
|
return batch
|
||||||
|
|
||||||
|
def get_batch_kwargs(self, batch):
|
||||||
|
"""
|
||||||
|
Return a kwargs dict for use with ``self.handler.make_batch()``, using
|
||||||
|
the given batch as a template.
|
||||||
|
"""
|
||||||
|
kwargs = {}
|
||||||
|
if batch.created_by:
|
||||||
|
kwargs['created_by'] = batch.created_by
|
||||||
|
elif batch.created_by_uuid:
|
||||||
|
kwargs['created_by_uuid'] = batch.created_by_uuid
|
||||||
|
if hasattr(batch, 'filename'):
|
||||||
|
kwargs['filename'] = batch.filename
|
||||||
|
return kwargs
|
||||||
|
|
||||||
def init_batch(self, batch):
|
def init_batch(self, batch):
|
||||||
"""
|
"""
|
||||||
Initialize a new batch. Derived classes can override this to
|
Initialize a new batch. Derived classes can override this to
|
||||||
|
@ -925,20 +939,6 @@ class FileBatchMasterView(BatchMasterView):
|
||||||
fs.filename,
|
fs.filename,
|
||||||
])
|
])
|
||||||
|
|
||||||
def get_batch_kwargs(self, batch):
|
|
||||||
"""
|
|
||||||
Return a kwargs dict for use with ``self.handler.make_batch()``, using
|
|
||||||
the given batch as a template.
|
|
||||||
"""
|
|
||||||
kwargs = {}
|
|
||||||
if batch.created_by:
|
|
||||||
kwargs['created_by'] = batch.created_by
|
|
||||||
elif batch.created_by_uuid:
|
|
||||||
kwargs['created_by_uuid'] = batch.created_by_uuid
|
|
||||||
if hasattr(batch, 'filename'):
|
|
||||||
kwargs['filename'] = batch.filename
|
|
||||||
return kwargs
|
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
"""
|
"""
|
||||||
View for downloading the data file associated with a batch.
|
View for downloading the data file associated with a batch.
|
||||||
|
|
Loading…
Reference in a new issue