def get(self, request, cu, roleIds = None, fileId = None, repos = None, **kwargs): sha1, isConfig = repquery.getFileSha1(cu, roleIds, fileId) if sha1 is None: return response.Response(status=404) localPath = repos.repos.contentsStore.hashToPath(sha1) bzippedFile = gzip.GzipFile(localPath, "r") uncompressedFile = util.BZ2File(bzippedFile) return CompressFileResponse(uncompressedFile)
def content(self, request, cu, roleIds = None, fileId = None, repos = None, **kwargs): sha1, isConfig = repquery.getFileSha1(cu, roleIds, fileId) if sha1 is None: return response.Response(status=404) localPath = repos.repos.contentsStore.hashToPath(sha1) if request.unparsedPath: remotePath = os.path.basename(request.unparsedPath) else: remotePath = sha1 return FileResponse(localPath, gzipped=True, remotePath=remotePath, download=not isConfig)
def get(self, request, cu, roleIds=None, fileId=None, repos=None, **kwargs): sha1, isConfig = repquery.getFileSha1(cu, roleIds, fileId) if sha1 is None: return response.Response(status=404) localPath = repos.repos.contentsStore.hashToPath(sha1) bzippedFile = gzip.GzipFile(localPath, "r") uncompressedFile = util.BZ2File(bzippedFile) return CompressFileResponse(uncompressedFile)
def content(self, request, cu, roleIds=None, fileId=None, repos=None, **kwargs): sha1, isConfig = repquery.getFileSha1(cu, roleIds, fileId) if sha1 is None: return response.Response(status=404) localPath = repos.repos.contentsStore.hashToPath(sha1) if request.unparsedPath: remotePath = os.path.basename(request.unparsedPath) else: remotePath = sha1 return FileResponse(localPath, gzipped=True, remotePath=remotePath, download=not isConfig)