Add core View.make_progress() method

so callers no longer need to import `SessionProgress` and create directly
This commit is contained in:
Lance Edgar 2019-09-25 00:10:17 -05:00
parent f0a5265a65
commit ff9700e23a
10 changed files with 31 additions and 14 deletions

View file

@ -56,7 +56,6 @@ from webhelpers2.html import HTML, tags
from tailbone import forms, grids
from tailbone.db import Session
from tailbone.views import MasterView
from tailbone.progress import SessionProgress
from tailbone.util import csrf_token
@ -824,7 +823,7 @@ class BatchMasterView(MasterView):
username = user.username if user else None
key = '{}.{}'.format(self.model_class.__tablename__, batch_action)
progress = SessionProgress(self.request, key)
progress = self.make_progress(key)
# must ensure versioning is *disabled* during action, if handler says so
allow_versioning = self.handler.allow_versioning(batch_action)
@ -1329,7 +1328,7 @@ class BatchMasterView(MasterView):
key = '{}.execute_results'.format(self.model_class.__tablename__)
batches = self.get_effective_data()
progress = SessionProgress(self.request, key)
progress = self.make_progress(key)
kwargs['progress'] = progress
thread = Thread(target=self.execute_results_thread, args=(batches, self.request.user.uuid), kwargs=kwargs)
thread.start()