Add render_progress()
method to core view class
This commit is contained in:
parent
a1094cc995
commit
e15888ffcd
|
@ -32,7 +32,6 @@ import random
|
|||
|
||||
from formalchemy.ext import fsblob
|
||||
from formalchemy.fields import FileFieldRenderer as Base
|
||||
from formalchemy.helpers import hidden_field
|
||||
|
||||
|
||||
class FileFieldRenderer(fsblob.FileFieldRenderer):
|
||||
|
|
|
@ -397,7 +397,7 @@ class BatchMasterView(MasterView):
|
|||
if not self.request.has_perm('{}.view'.format(permission_prefix)):
|
||||
kwargs['cancel_url'] = self.request.route_url('{}.create'.format(route_prefix))
|
||||
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
return self.render_progress(kwargs)
|
||||
|
||||
def refresh_data(self, session, batch, cognizer=None, progress=None):
|
||||
"""
|
||||
|
@ -649,7 +649,7 @@ class BatchMasterView(MasterView):
|
|||
'cancel_url': self.get_action_url('view', batch),
|
||||
'cancel_msg': "Batch execution was canceled.",
|
||||
}
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
return self.render_progress(kwargs)
|
||||
|
||||
def execute_thread(self, batch_uuid, user_uuid, progress=None):
|
||||
"""
|
||||
|
@ -1453,7 +1453,7 @@ class BatchCrud(BaseCrud):
|
|||
'cancel_url': self.view_url(batch.uuid),
|
||||
'cancel_msg': "Batch refresh was canceled.",
|
||||
}
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
return self.render_progress(kwargs)
|
||||
|
||||
def refresh_data(self, session, batch, cognizer=None, progress=None):
|
||||
"""
|
||||
|
@ -1533,7 +1533,7 @@ class BatchCrud(BaseCrud):
|
|||
'cancel_url': self.view_url(batch.uuid),
|
||||
'cancel_msg': "Batch execution was canceled.",
|
||||
}
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
return self.render_progress(kwargs)
|
||||
|
||||
def execute_thread(self, batch_uuid, progress=None):
|
||||
"""
|
||||
|
|
|
@ -172,7 +172,7 @@ class ExecuteBatch(View):
|
|||
'cancel_url': self.request.route_url('batch.rows', uuid=batch.uuid),
|
||||
'cancel_msg': "Batch execution was canceled.",
|
||||
}
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
return self.render_progress(kwargs)
|
||||
|
||||
|
||||
def includeme(config):
|
||||
|
|
|
@ -29,6 +29,7 @@ from __future__ import unicode_literals, absolute_import
|
|||
from rattail.db import model
|
||||
|
||||
from pyramid import httpexceptions
|
||||
from pyramid.renderers import render_to_response
|
||||
|
||||
from tailbone.db import Session
|
||||
|
||||
|
@ -64,6 +65,12 @@ class View(object):
|
|||
"""
|
||||
return httpexceptions.HTTPFound(location=url, **kwargs)
|
||||
|
||||
def render_progress(self, kwargs):
|
||||
"""
|
||||
Render the progress page, with given kwargs as context.
|
||||
"""
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
|
||||
|
||||
def fake_error(request):
|
||||
"""
|
||||
|
|
|
@ -343,7 +343,7 @@ class ProductsView(MasterView):
|
|||
'cancel_url': self.request.route_url('products'),
|
||||
'cancel_msg': "Batch creation was canceled.",
|
||||
}
|
||||
return render_to_response('/progress.mako', kwargs, request=self.request)
|
||||
return self.render_progress(kwargs)
|
||||
|
||||
enabled = self.rattail_config.get('rattail.pyramid', 'batches.providers')
|
||||
if enabled:
|
||||
|
|
Loading…
Reference in a new issue