mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
p3
This commit is contained in:
@@ -33,7 +33,7 @@ class BackupManager:
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
return render(request, 'backup/index.html', currentACL)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def backupSite(self, request = None, userID = None, data = None):
|
||||
@@ -45,7 +45,7 @@ class BackupManager:
|
||||
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
return render(request, 'backup/backup.html', {'websiteList': websitesName})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def restoreSite(self, request = None, userID = None, data = None):
|
||||
@@ -73,7 +73,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/restore.html', {'backups': all_files})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def getCurrentBackups(self, userID = None, data = None):
|
||||
@@ -120,7 +120,7 @@ class BackupManager:
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -157,7 +157,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'status': 1, 'metaStatus': 1, 'error_message': "None", 'tempStorage': tempStoragePath})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -240,7 +240,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'backupStatus': 0, 'error_message': "None", "status": 0, "abort": 0})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'backupStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupStatus]")
|
||||
@@ -259,13 +259,13 @@ class BackupManager:
|
||||
try:
|
||||
backupOb = Backups.objects.get(fileName=fileName)
|
||||
backupOb.delete()
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [cancelBackupCreation]")
|
||||
|
||||
final_json = json.dumps({'abortStatus': 1, 'error_message': "None", "status": 0})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'abortStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -291,7 +291,7 @@ class BackupManager:
|
||||
|
||||
final_json = json.dumps({'status': 1, 'deleteStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
@@ -321,7 +321,7 @@ class BackupManager:
|
||||
final_dic = {'restoreStatus': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'restoreStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -368,7 +368,7 @@ class BackupManager:
|
||||
'running': 'Running..'})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
status = "Just Started"
|
||||
final_json = json.dumps(
|
||||
@@ -381,7 +381,7 @@ class BackupManager:
|
||||
'abort': 1})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'restoreStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -395,7 +395,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/backupDestinations.html', {})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitDestinationCreation(self, userID = None, data = None):
|
||||
@@ -457,7 +457,7 @@ class BackupManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'destStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -492,7 +492,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -520,7 +520,7 @@ class BackupManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'connStatus': 1, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -573,7 +573,7 @@ class BackupManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'delStatus': 1, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -600,7 +600,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/backupSchedule.html', {'destinations': destinations})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def getCurrentBackupSchedules(self, userID = None, data = None):
|
||||
@@ -631,7 +631,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -741,7 +741,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'scheduleStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'scheduleStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -802,7 +802,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'delStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'delStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -815,7 +815,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/remoteBackups.html')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitRemoteBackups(self, userID = None, data = None):
|
||||
@@ -858,7 +858,7 @@ class BackupManager:
|
||||
return HttpResponse(data_ret)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0,
|
||||
'error_message': "Not able to fetch version of remote server. Error Message: " + str(
|
||||
msg),
|
||||
@@ -930,14 +930,14 @@ class BackupManager:
|
||||
data['error_message'], "dir": "Null"}
|
||||
data_ret = json.dumps(data_ret)
|
||||
return HttpResponse(data_ret)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0,
|
||||
'error_message': "Not able to fetch accounts from remote server. Error Message: " + str(
|
||||
msg), "dir": "Null"}
|
||||
data_ret = json.dumps(data_ret)
|
||||
return HttpResponse(data_ret)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -995,13 +995,13 @@ class BackupManager:
|
||||
data['error_message']})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'remoteTransferStatus': 0,
|
||||
'error_message': "Can not initiate remote transfer. Error message: " +
|
||||
str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'remoteTransferStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -1045,7 +1045,7 @@ class BackupManager:
|
||||
'backupsSent': 0}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'remoteTransferStatus': 0, 'error_message': str(msg), 'backupsSent': 0}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1075,7 +1075,7 @@ class BackupManager:
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'remoteRestoreStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1122,7 +1122,7 @@ class BackupManager:
|
||||
"complete": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'remoteTransferStatus': 0, 'error_message': str(msg), "status": "None", "complete": 0}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1168,7 +1168,7 @@ class BackupManager:
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'cancelStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
Reference in New Issue
Block a user