diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -360,9 +360,9 @@ class FilesController(BaseRepoController except (ImproperArchiveTypeError, KeyError): return _('Unknown archive type') - archive = tempfile.NamedTemporaryFile(mode='w+r+b') + archive = tempfile.NamedTemporaryFile(mode='w+r+b', delete=False) cs.fill_archive(stream=archive, kind=fileformat, subrepos=subrepos) - + archive.close() response.content_type = content_type response.content_disposition = 'attachment; filename=%s-%s%s' \ % (repo_name, revision[:12], ext) @@ -373,9 +373,10 @@ class FilesController(BaseRepoController data = tmpfile.read(16 * 1024) if not data: tmpfile.close() + os.unlink(tmpfile.name) break yield data - return get_chunked_archive(tmpfile=archive) + return get_chunked_archive(tmpfile=open(archive.name,'rb')) @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin') diff --git a/rhodecode/lib/auth.py b/rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py +++ b/rhodecode/lib/auth.py @@ -64,7 +64,7 @@ class PasswordGenerator(object): passwd_gen = PasswordGenerator() #print 8-letter password containing only big and small letters of alphabet - print passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL) + passwd_gen.gen_password(8, passwd_gen.ALPHABETS_BIG_SMALL) """ ALPHABETS_NUM = r'''1234567890''' ALPHABETS_SMALL = r'''qwertyuiopasdfghjklzxcvbnm''' diff --git a/rhodecode/lib/utils2.py b/rhodecode/lib/utils2.py --- a/rhodecode/lib/utils2.py +++ b/rhodecode/lib/utils2.py @@ -215,7 +215,6 @@ def safe_str(unicode_, to_encoding=None) try: import chardet encoding = chardet.detect(unicode_)['encoding'] - print encoding if encoding is None: raise UnicodeEncodeError() diff --git a/rhodecode/lib/vcs/backends/git/changeset.py b/rhodecode/lib/vcs/backends/git/changeset.py --- a/rhodecode/lib/vcs/backends/git/changeset.py +++ b/rhodecode/lib/vcs/backends/git/changeset.py @@ -240,11 +240,11 @@ class GitChangeset(BaseChangeset): which is generally not good. Should be replaced with algorithm iterating commits. """ - cmd = 'log --pretty="format: --%%H--" --name-status -p %s -- "%s"' % ( + cmd = 'log --pretty="format: %%H" -s -p %s -- "%s"' % ( self.id, path ) so, se = self.repository.run_git_command(cmd) - ids = re.findall(r'(?:--)(\w{40})(?:--)', so) + ids = re.findall(r'[0-9a-fA-F]{40}', so) return [self.repository.get_changeset(id) for id in ids] def get_file_annotate(self, path): diff --git a/rhodecode/lib/vcs/utils/__init__.py b/rhodecode/lib/vcs/utils/__init__.py --- a/rhodecode/lib/vcs/utils/__init__.py +++ b/rhodecode/lib/vcs/utils/__init__.py @@ -90,7 +90,6 @@ def safe_str(unicode_, to_encoding=None) try: import chardet encoding = chardet.detect(unicode_)['encoding'] - print encoding if encoding is None: raise UnicodeEncodeError() diff --git a/rhodecode/model/user.py b/rhodecode/model/user.py --- a/rhodecode/model/user.py +++ b/rhodecode/model/user.py @@ -531,7 +531,6 @@ class UserModel(BaseModel): for perm in user_repo_group_perms_from_users_groups: g_k = perm.UsersGroupRepoGroupToPerm.group.group_name - print perm, g_k p = perm.Permission.permission_name cur_perm = user.permissions[GK][g_k] # overwrite permission only if it's greater than permission diff --git a/rhodecode/tests/functional/test_files.py b/rhodecode/tests/functional/test_files.py --- a/rhodecode/tests/functional/test_files.py +++ b/rhodecode/tests/functional/test_files.py @@ -190,10 +190,11 @@ class TestFilesController(TestController self.log_user() for arch_ext, info in ARCHIVE_SPECS.items(): + short = '27cd5cce30c9%s' % arch_ext fname = '27cd5cce30c96924232dffcd24178a07ffeb5dfc%s' % arch_ext - filename = '%s-%s' % (HG_REPO, fname) - - response = self.app.get(url(controller='files', action='archivefile', + filename = '%s-%s' % (HG_REPO, short) + response = self.app.get(url(controller='files', + action='archivefile', repo_name=HG_REPO, fname=fname)) @@ -202,7 +203,8 @@ class TestFilesController(TestController [('Pragma', 'no-cache'), ('Cache-Control', 'no-cache'), ('Content-Type', '%s; charset=utf-8' % info[0]), - ('Content-Disposition', 'attachment; filename=%s' % filename),] + ('Content-Disposition', 'attachment; filename=%s' % filename), + ] ) def test_archival_wrong_ext(self):