def getParmsForPage(self, repoPath, repoName): rdiffHistory = librdiff.getBackupHistory(repoPath) rdiffHistory.reverse() entries = [] cumulativeSize = 0 if len(rdiffHistory) > 0: cumulativeSize = rdiffHistory[0].size for historyItem in rdiffHistory: fileSize = "" incrementSize = "" cumulativeSizeStr = "" if not historyItem.inProgress: fileSize = rdw_helpers.formatFileSizeStr(historyItem.size) incrementSize = rdw_helpers.formatFileSizeStr(historyItem.incrementSize) cumulativeSize += historyItem.incrementSize cumulativeSizeStr = rdw_helpers.formatFileSizeStr(cumulativeSize) entries.append({ "date" : historyItem.date.getDisplayString(), "dateinseconds" : historyItem.date.getLocalSeconds(), "inProgress" : historyItem.inProgress, "errors" : historyItem.errors, "cumulativesize" : cumulativeSizeStr, "cumulativesizeinbytes" : cumulativeSize, "size" : fileSize, "sizeinbytes" : historyItem.size }) return {"title" : "Backup history for " + repoName, "history" : entries, "totalBackups" : len(rdiffHistory)}
def getParmsForPage(self, repoPath, repoName): rdiffHistory = librdiff.getBackupHistory(repoPath) rdiffHistory.reverse() entries = [] cumulativeSize = 0 if len(rdiffHistory) > 0: cumulativeSize = rdiffHistory[0].size for historyItem in rdiffHistory: fileSize = "" incrementSize = "" cumulativeSizeStr = "" if not historyItem.inProgress: fileSize = rdw_helpers.formatFileSizeStr(historyItem.size) incrementSize = rdw_helpers.formatFileSizeStr( historyItem.incrementSize) cumulativeSize += historyItem.incrementSize cumulativeSizeStr = rdw_helpers.formatFileSizeStr( cumulativeSize) entries.append({ "date": historyItem.date.getDisplayString(), "inProgress": historyItem.inProgress, "errors": historyItem.errors, "cumulativeSize": cumulativeSizeStr, "size": fileSize }) return { "title": "Backup history for " + repoName, "history": entries, "totalBackups": len(rdiffHistory) }
def getParmsForPage(self, repoPath, repoName): rdiffHistory = librdiff.getBackupHistory(repoPath) rdiffHistory.reverse() entries = [] for historyItem in rdiffHistory: sizeStr = "" if not historyItem.inProgress: sizeStr = rdw_helpers.formatFileSizeStr(historyItem.size) entries.append({ "date" : historyItem.date.getDisplayString(), "inProgress" : historyItem.inProgress, "errors" : historyItem.errors, "size" : sizeStr }) return {"title" : "Backup history for "+repoName, "history" : entries}
def getParmsForPage(self, repoPath, repoName, allowHistoryDeletion=False, message='', error=''): rdiffHistory = librdiff.getBackupHistory(repoPath) rdiffHistory.reverse() entries = [] cumulativeSize = 0 if len(rdiffHistory) > 0: cumulativeSize = rdiffHistory[0].size for historyItem in rdiffHistory: fileSize = "" incrementSize = "" cumulativeSizeStr = "" if not historyItem.inProgress: fileSize = rdw_helpers.formatFileSizeStr(historyItem.size) cumulativeSize += historyItem.incrementSize cumulativeSizeStr = rdw_helpers.formatFileSizeStr( cumulativeSize) entries.append({ "date": historyItem.date.getDisplayString(), "rawDate": historyItem.date.getUrlString(), "inProgress": historyItem.inProgress, "errors": historyItem.errors, "cumulativeSize": cumulativeSizeStr, "rawIncrementSize": historyItem.incrementSize, "size": fileSize }) # Now, go backwards through the history, and calculate space used by increments cumulativeSize = 0 for entry in reversed(entries): entry['priorIncrementsSize'] = rdw_helpers.formatFileSizeStr( cumulativeSize) cumulativeSize += entry['rawIncrementSize'] # Don't allow history deletion for the last item if entries: entries[-1]['allowHistoryDeletion'] = False return { "title": "Backup history for " + repoName, "history": entries, "totalBackups": len(rdiffHistory), "allowHistoryDeletion": allowHistoryDeletion, "message": message, "error": error }
def getParmsForPage(self, repoPath, repoName): rdiffHistory = librdiff.getBackupHistory(repoPath) rdiffHistory.reverse() entries = [] for historyItem in rdiffHistory: sizeStr = "" if not historyItem.inProgress: sizeStr = rdw_helpers.formatFileSizeStr(historyItem.size) entries.append({ "date": historyItem.date.getDisplayString(), "inProgress": historyItem.inProgress, "errors": historyItem.errors, "size": sizeStr }) return {"title": "Backup history for " + repoName, "history": entries}
def getParmsForPage(self, repoPath, repoName, allowHistoryDeletion=False, message="", error=""): rdiffHistory = librdiff.getBackupHistory(repoPath) rdiffHistory.reverse() entries = [] cumulativeSize = 0 if len(rdiffHistory) > 0: cumulativeSize = rdiffHistory[0].size for historyItem in rdiffHistory: fileSize = "" incrementSize = "" cumulativeSizeStr = "" if not historyItem.inProgress: fileSize = rdw_helpers.formatFileSizeStr(historyItem.size) cumulativeSize += historyItem.incrementSize cumulativeSizeStr = rdw_helpers.formatFileSizeStr(cumulativeSize) entries.append( { "date": historyItem.date.getDisplayString(), "rawDate": historyItem.date.getUrlString(), "inProgress": historyItem.inProgress, "errors": historyItem.errors, "cumulativeSize": cumulativeSizeStr, "rawIncrementSize": historyItem.incrementSize, "size": fileSize, } ) # Now, go backwards through the history, and calculate space used by increments cumulativeSize = 0 for entry in reversed(entries): entry["priorIncrementsSize"] = rdw_helpers.formatFileSizeStr(cumulativeSize) cumulativeSize += entry["rawIncrementSize"] # Don't allow history deletion for the last item if entries: entries[-1]["allowHistoryDeletion"] = False return { "title": "Backup history for " + repoName, "history": entries, "totalBackups": len(rdiffHistory), "allowHistoryDeletion": allowHistoryDeletion, "message": message, "error": error, }
class rdiffHistoryPage(page_main.rdiffPage): def index(self, repo): try: rdw_helpers.ensurePathValid(repo) except rdw_helpers.accessDeniedError, error: return self.writeErrorPage(str(error)) if not repo: return self.writeErrorPage("Backup location not specified.") if not repo in self.userDB.getUserRepoPaths(self.getUsername()): return self.writeErrorPage("Access is denied.") page = self.startPage("Backup History") page = page + self.writeTopLinks() try: rdiffHistory = librdiff.getBackupHistory( joinPaths(self.userDB.getUserRoot(self.getUsername()), repo)) except librdiff.FileError, error: return self.writeErrorPage(error.getErrorString())
def index(self): page = self.startPage("Backup Locations") page = page + self.writeTopLinks() repoList = [] for userRepo in self.userDB.getUserRepoPaths(self.getUsername()): try: repoHistory = librdiff.getBackupHistory(rdw_helpers.joinPaths(self.userDB.getUserRoot(self.getUsername()), userRepo), 1) except librdiff.FileError: repoSize = "0" repoDate = "Error" else: repoSize = rdw_helpers.formatFileSizeStr(repoHistory[0].size) repoDate = repoHistory[0].date.getDisplayString() repoList.append({ "repoName" : userRepo, "repoSize" : repoSize, "repoDate" : repoDate, "repoBrowseUrl" : self.buildBrowseUrl(userRepo, "/"), "repoHistoryUrl" : self.buildHistoryUrl(userRepo) }) page = page + self.compileTemplate("repo_listing.html", title="browse", repos=repoList) page = page + self.endPage() return page