Changeset - 73b2fc324c1e
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-05-03 21:27:57
marcin@python-works.com
changes for archivals in rhodecode. Also made it work for git that way
1 file changed with 15 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -303,7 +303,21 @@ class FilesController(BaseRepoController
 
        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')
0 comments (0 inline, 0 general)