def log_record(request): if request.method == "GET": return render(request, 'jlog/record.html') elif request.method == "POST": log_id = request.REQUEST.get('id', None) if log_id: TermL = TermLogRecorder(request.user) log = Log.objects.get(id=int(log_id)) if len(log.filename) == 0: log_file = log.log_path + '.log' log_time = log.log_path + '.time' if os.path.isfile(log_file) and os.path.isfile(log_time): content = renderJSON(log_file, log_time) return HttpResponse(content) else: return HttpResponse(TermL.load_full_log(filename=log.filename)) else: return HttpResponse("ERROR") else: return HttpResponse("ERROR METHOD!")
def log_record(request): """ Author: [email protected] """ if request.method == "GET": return render(request, 'jlog/record.html') elif request.method == "POST": log_id = request.REQUEST.get('id', None) if log_id: TermL = TermLogRecorder(request.user) log = Log.objects.get(id=int(log_id)) if len(log.filename) == 0: log_file = log.log_path + '.log' log_time = log.log_path + '.time' if os.path.isfile(log_file) and os.path.isfile(log_time): content = renderJSON(log_file, log_time) return HttpResponse(content) else: return HttpResponse(TermL.load_full_log(filename=log.filename)) else: return HttpResponse("ERROR") else: return HttpResponse("ERROR METHOD!")