Move get_batch_kwargs() to BatchMasterView

This commit is contained in:
Lance Edgar 2016-11-20 16:03:28 -06:00
parent d9145e5122
commit 339f3c6361

View file

@ -265,6 +265,20 @@ class BatchMasterView(MasterView):
# return this object to replace the original
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):
"""
Initialize a new batch. Derived classes can override this to
@ -925,20 +939,6 @@ class FileBatchMasterView(BatchMasterView):
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):
"""
View for downloading the data file associated with a batch.