Changeset - b8d5a5c9f66d
[Not reviewed]
Merge default
0 8 0
Marcin Kuzminski - 14 years ago 2012-05-16 01:25:00
marcin@python-works.com
merge with beta
7 files changed with 13 insertions and 13 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -357,28 +357,29 @@ class FilesController(BaseRepoController
 
            return _('Unknown revision %s') % revision
 
        except EmptyRepositoryError:
 
            return _('Empty repository')
 
        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)
 
        response.content_length = str(os.path.getsize(archive.name))
 

	
 
        def get_chunked_archive(tmpfile):
 
            while True:
 
                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')
 
    def diff(self, repo_name, f_path):
 
        ignore_whitespace = request.GET.get('ignorews') == '1'
 
        line_context = request.GET.get('context', 3)
rhodecode/lib/auth.py
Show inline comments
 
@@ -61,13 +61,13 @@ class PasswordGenerator(object):
 
    characters
 
    usage::
 

	
 
        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'''
 
    ALPHABETS_BIG = r'''QWERTYUIOPASDFGHJKLZXCVBNM'''
 
    ALPHABETS_SPECIAL = r'''`-=[]\;',./~!@#$%^&*()_+{}|:"<>?'''
 
    ALPHABETS_FULL = ALPHABETS_BIG + ALPHABETS_SMALL \
rhodecode/lib/utils2.py
Show inline comments
 
@@ -212,13 +212,12 @@ def safe_str(unicode_, to_encoding=None)
 
    except UnicodeEncodeError:
 
        pass
 

	
 
    try:
 
        import chardet
 
        encoding = chardet.detect(unicode_)['encoding']
 
        print encoding
 
        if encoding is None:
 
            raise UnicodeEncodeError()
 

	
 
        return unicode_.encode(encoding)
 
    except (ImportError, UnicodeEncodeError):
 
        return unicode_.encode(to_encoding, 'replace')
rhodecode/lib/vcs/backends/git/changeset.py
Show inline comments
 
@@ -237,17 +237,17 @@ class GitChangeset(BaseChangeset):
 
        which file at given ``path`` has been modified.
 

	
 
        TODO: This function now uses os underlying 'git' and 'grep' commands
 
        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):
 
        """
 
        Returns a list of three element tuples with lineno,changeset and line
 

	
rhodecode/lib/vcs/utils/__init__.py
Show inline comments
 
@@ -87,13 +87,12 @@ def safe_str(unicode_, to_encoding=None)
 
    except UnicodeEncodeError:
 
        pass
 

	
 
    try:
 
        import chardet
 
        encoding = chardet.detect(unicode_)['encoding']
 
        print encoding
 
        if encoding is None:
 
            raise UnicodeEncodeError()
 

	
 
        return unicode_.encode(encoding)
 
    except (ImportError, UnicodeEncodeError):
 
        return unicode_.encode(to_encoding, 'replace')
rhodecode/model/user.py
Show inline comments
 
@@ -528,13 +528,12 @@ class UserModel(BaseModel):
 
         .join((UsersGroupMember, UsersGroupRepoGroupToPerm.users_group_id == UsersGroupMember.users_group_id))\
 
         .filter(UsersGroupMember.user_id == uid)\
 
         .all()
 

	
 
        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
 
            # given from other sources
 
            if PERM_WEIGHTS[p] > PERM_WEIGHTS[cur_perm]:
 
                user.permissions[GK][g_k] = p
rhodecode/tests/functional/test_files.py
Show inline comments
 
@@ -187,25 +187,27 @@ class TestFilesController(TestController
 
        response.mustcontain("""<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""")
 

	
 
    def test_archival(self):
 
        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))
 

	
 
            self.assertEqual(response.status, '200 OK')
 
            self.assertEqual(response.response._headers.items(),
 
             [('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):
 
        self.log_user()
 

	
 
        for arch_ext in ['tar', 'rar', 'x', '..ax', '.zipz']:
0 comments (0 inline, 0 general)