def backupStatus(request): try: userID = 1 wm = BackupManager() return wm.backupStatus(userID, json.loads(request.body)) except KeyError: return redirect(loadLoginPage)
def cancelBackupCreation(request): try: userID = request.session['userID'] wm = BackupManager() return wm.cancelBackupCreation(userID, json.loads(request.body)) except KeyError: return redirect(loadLoginPage)
def getCurrentBackups(request): try: userID = request.session['userID'] wm = BackupManager() return wm.getCurrentBackups(userID, json.loads(request.body)) except KeyError: return redirect(loadLoginPage)
def restoreSite(request): try: userID = request.session['userID'] bm = BackupManager() return bm.restoreSite(request, userID) except KeyError: return redirect(loadLoginPage)
def scheduleBackup(request): try: userID = request.session['userID'] bm = BackupManager() return bm.scheduleBackup(request, userID) except KeyError: return redirect(loadLoginPage)
def localRestoreStatus(request): try: userID = request.session['userID'] wm = BackupManager() return wm.localRestoreStatus(userID, json.loads(request.body)) except KeyError: return redirect(loadLoginPage)
def getRemoteTransferStatus(request): try: userID = request.session['userID'] wm = BackupManager() return wm.getRemoteTransferStatus(userID, json.loads(request.body)) except KeyError: return redirect(loadLoginPage)
def getConnectionStatus(request): try: userID = request.session['userID'] bm = BackupManager() return bm.getConnectionStatus(userID, json.loads(request.body)) except KeyError: return redirect(loadLoginPage)
def backupDestinations(request): try: userID = request.session['userID'] bm = BackupManager() return bm.backupDestinations(request, userID) except KeyError: return redirect(loadLoginPage)
def localInitiate(request): try: data = json.loads(request.body) randomFile = data['randomFile'] if os.path.exists(randomFile): wm = BackupManager() return wm.submitBackupCreation(1, json.loads(request.body)) except BaseException, msg: logging.writeToFile(str(msg))
def submitRestore(request): try: userID = request.session['userID'] result = pluginManager.preSubmitRestore(request) if result != 200: return result wm = BackupManager() coreResult = wm.submitRestore(json.loads(request.body), userID) return coreResult except KeyError: return redirect(loadLoginPage)
def submitBackupCreation(request): try: userID = request.session['userID'] result = pluginManager.preSubmitBackupCreation(request) if result != 200: return result wm = BackupManager() coreResult = wm.submitBackupCreation(userID, json.loads(request.body)) return coreResult except BaseException, msg: logging.writeToFile(str(msg))
def remoteBackupRestore(request): try: userID = request.session['userID'] result = pluginManager.preRemoteBackupRestore(request) if result != 200: return result wm = BackupManager() coreResult = wm.remoteBackupRestore(userID, json.loads(request.body)) result = pluginManager.postRemoteBackupRestore(request, coreResult) if result != 200: return result return coreResult except KeyError: return redirect(loadLoginPage)
def deleteDestination(request): try: userID = request.session['userID'] result = pluginManager.preDeleteDestination(request) if result != 200: return result wm = BackupManager() coreResult = wm.deleteDestination(userID, json.loads(request.body)) result = pluginManager.postDeleteDestination(request, coreResult) if result != 200: return result return coreResult except KeyError: return redirect(loadLoginPage)
def restoreStatus(request): try: wm = BackupManager() return wm.restoreStatus(json.loads(request.body)) except KeyError: return redirect(loadLoginPage)