pull/170/head
liuzheng712 9 years ago
parent 958909551d
commit f3d863ea45

@ -394,7 +394,7 @@ class SshTty(Tty):
log_file_f.close() log_file_f.close()
log_time_f.close() log_time_f.close()
termlog.save() termlog.save()
log.log_path = termlog.filename log.filename = termlog.filename
log.is_finished = True log.is_finished = True
log.end_time = datetime.datetime.now() log.end_time = datetime.datetime.now()
log.save() log.save()

@ -13,6 +13,7 @@ class Log(models.Model):
pid = models.IntegerField() pid = models.IntegerField()
is_finished = models.BooleanField(default=False) is_finished = models.BooleanField(default=False)
end_time = models.DateTimeField(null=True) end_time = models.DateTimeField(null=True)
filename = models.CharField(max_length=40)
''' '''
add by liuzheng add by liuzheng
''' '''

@ -138,7 +138,7 @@ def log_record(request):
if log_id: if log_id:
TermL = TermLogRecorder(request.user) TermL = TermLogRecorder(request.user)
log = Log.objects.get(id=int(log_id)) log = Log.objects.get(id=int(log_id))
return HttpResponse(TermL.load_full_log(filename=log.log_path)) return HttpResponse(TermL.load_full_log(filename=log.filename))
else: else:
return HttpResponse("ERROR") return HttpResponse("ERROR")
else: else:

@ -399,7 +399,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self.log_file_f.write('End time is %s' % datetime.datetime.now()) self.log_file_f.write('End time is %s' % datetime.datetime.now())
self.log.is_finished = True self.log.is_finished = True
self.log.end_time = datetime.datetime.now() self.log.end_time = datetime.datetime.now()
self.log.log_path = self.termlog.filename self.log.filename = self.termlog.filename
self.log.save() self.log.save()
self.log_time_f.close() self.log_time_f.close()
self.ssh.close() self.ssh.close()

Loading…
Cancel
Save