Mercurial > public > src > rhodecode
changeset 1386:73b2fc324c1e beta
changes for archivals in rhodecode. Also made it work for git that way
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 03 May 2011 21:27:57 +0200 |
parents | c1516b35f91d |
children | 61a6a7bf2cbd |
files | rhodecode/controllers/files.py |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/files.py Tue May 03 16:54:43 2011 +0200 +++ b/rhodecode/controllers/files.py Tue May 03 21:27:57 2011 +0200 @@ -303,7 +303,21 @@ response.content_disposition = 'attachment; filename=%s-%s%s' \ % (repo_name, revision, ext) - return cs.get_chunked_archive(stream=None, kind=fileformat) + import tempfile + archive = tempfile.mkstemp()[1] + t = open(archive, 'wb') + cs.fill_archive(stream=t, kind=fileformat) + + def get_chunked_archive(archive): + stream = open(archive, 'rb') + while True: + data = stream.read(4096) + if not data: + os.remove(archive) + break + yield data + + return get_chunked_archive(archive) @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin')