From 35bcc1f6c37228770aa391060e0a284b49e59d81 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 3 Mar 2021 19:29:48 +0500 Subject: [PATCH] add default renderer to tuning --- tuning/tuning.py | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/tuning/tuning.py b/tuning/tuning.py index 74eedbeed..76956181b 100755 --- a/tuning/tuning.py +++ b/tuning/tuning.py @@ -2,10 +2,13 @@ import os.path import sys import django + +from plogical.httpProc import httpProc + sys.path.append('/usr/local/CyberCP') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") django.setup() -from django.shortcuts import render,redirect +from django.shortcuts import redirect from django.http import HttpResponse import json import plogical.CyberCPLogFileWriter as logging @@ -18,49 +21,31 @@ from plogical.processUtilities import ProcessUtilities class tuningManager: def loadTuningHome(self, request, userID): - try: - userID = request.session['userID'] - currentACL = ACLManager.loadedACL(userID) - - if currentACL['admin'] == 1: - pass - else: - return ACLManager.loadError() - - return render(request, 'tuning/index.html', {}) - except KeyError: - return redirect(loadLoginPage) + proc = httpProc(request, 'tuning/index.html', + None, 'admin') + return proc.render() def liteSpeedTuning(self, request, userID): - try: - userID = request.session['userID'] - currentACL = ACLManager.loadedACL(userID) - - if currentACL['admin'] == 1: - pass - else: - return ACLManager.loadError() - return render(request, 'tuning/liteSpeedTuning.html', {}) - except KeyError: - return redirect(loadLoginPage) + proc = httpProc(request, 'tuning/liteSpeedTuning.html', + None, 'admin') + return proc.render() def phpTuning(self, request, userID): try: userID = request.session['userID'] currentACL = ACLManager.loadedACL(userID) - if currentACL['admin'] == 1: - pass - else: - return ACLManager.loadError() - if ProcessUtilities.decideServer() == ProcessUtilities.OLS: websitesName = ACLManager.findAllSites(currentACL, userID) OLS = 1 - return render(request, 'tuning/phpTuning.html', {'websiteList': websitesName, 'OLS': OLS}) + proc = httpProc(request, 'tuning/phpTuning.html', + {'websiteList': websitesName, 'OLS': OLS}, 'admin') + return proc.render() else: OLS = 0 - return render(request, 'tuning/phpTuning.html', {'OLS': OLS}) + proc = httpProc(request, 'tuning/phpTuning.html', + {'OLS': OLS}, 'admin') + return proc.render() except KeyError: return redirect(loadLoginPage)