Fix upgrade stdout handling if file doesn't exist yet

plus some other tweaks..
This commit is contained in:
Lance Edgar 2017-08-09 11:56:25 -05:00
parent e5b0fe7198
commit 773a0c769d
3 changed files with 19 additions and 12 deletions

View file

@ -12,11 +12,13 @@
location.href = '${cancel_url}';
} else {
if (data.stdout) {
var stdout = $('.stdout');
var height = $(window).height() - stdout.offset().top - 50;
stdout.height(height);
stdout.append(data.stdout);
stdout.animate({scrollTop: stdout.get(0).scrollHeight - height}, 250);
}
if (data.complete || data.maximum) {
$('#message').html(data.message);

View file

@ -895,6 +895,10 @@ class MasterView(View):
progress.session['success_url'] = success_url
progress.session.save()
def execute_error_message(self, error):
return "Execution of {} failed: {}: {}".format(self.get_model_title(),
type(error).__name__, error)
def get_execute_success_url(self, obj, **kwargs):
return self.get_action_url('view', obj, **kwargs)

View file

@ -298,6 +298,7 @@ class UpgradeView(MasterView):
path = self.rattail_config.upgrade_filepath(upgrade.uuid, filename='stdout.log')
offset = session.get('stdout.offset', 0)
if os.path.exists(path):
size = os.path.getsize(path) - offset
with open(path, 'rb') as f:
f.seek(offset)