Show More
@@ -101,7 +101,7 b' def main(argv=None):' | |||||
101 | parser.error('Please specify method name') |
|
101 | parser.error('Please specify method name') | |
102 |
|
102 | |||
103 | try: |
|
103 | try: | |
104 |
margs = dict( |
|
104 | margs = dict(s.split(':', 1) for s in other) | |
105 | except ValueError: |
|
105 | except ValueError: | |
106 | sys.stderr.write('Error parsing arguments \n') |
|
106 | sys.stderr.write('Error parsing arguments \n') | |
107 | sys.exit() |
|
107 | sys.exit() |
@@ -25,7 +25,6 b' Original author and date, and relevant c' | |||||
25 | :license: GPLv3, see LICENSE.md for more details. |
|
25 | :license: GPLv3, see LICENSE.md for more details. | |
26 | """ |
|
26 | """ | |
27 |
|
27 | |||
28 | import itertools |
|
|||
29 | import logging |
|
28 | import logging | |
30 | import traceback |
|
29 | import traceback | |
31 |
|
30 | |||
@@ -42,7 +41,7 b' from kallithea.config.routing import url' | |||||
42 | from kallithea.lib import helpers as h |
|
41 | from kallithea.lib import helpers as h | |
43 | from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired |
|
42 | from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired | |
44 | from kallithea.lib.base import BaseController, render |
|
43 | from kallithea.lib.base import BaseController, render | |
45 | from kallithea.lib.utils2 import safe_int |
|
44 | from kallithea.lib.utils2 import safe_int, safe_unicode | |
46 | from kallithea.model.db import RepoGroup, Repository |
|
45 | from kallithea.model.db import RepoGroup, Repository | |
47 | from kallithea.model.forms import RepoGroupForm, RepoGroupPermsForm |
|
46 | from kallithea.model.forms import RepoGroupForm, RepoGroupPermsForm | |
48 | from kallithea.model.meta import Session |
|
47 | from kallithea.model.meta import Session | |
@@ -120,9 +119,7 b' class RepoGroupsController(BaseControlle' | |||||
120 | ) |
|
119 | ) | |
121 |
|
120 | |||
122 | for repo_gr in group_iter: |
|
121 | for repo_gr in group_iter: | |
123 | children_groups = map(h.safe_unicode, |
|
122 | children_groups = [safe_unicode(g.name) for g in repo_gr.parents] + [safe_unicode(repo_gr.name)] | |
124 | itertools.chain((g.name for g in repo_gr.parents), |
|
|||
125 | (x.name for x in [repo_gr]))) |
|
|||
126 | repo_count = repo_gr.repositories.count() |
|
123 | repo_count = repo_gr.repositories.count() | |
127 | repo_groups_data.append({ |
|
124 | repo_groups_data.append({ | |
128 | "raw_name": repo_gr.group_name, |
|
125 | "raw_name": repo_gr.group_name, |
@@ -168,7 +168,7 b' class JSONRPCController(TGController):' | |||||
168 | # self.kargs and dispatch control to WGIController |
|
168 | # self.kargs and dispatch control to WGIController | |
169 | argspec = inspect.getargspec(self._func) |
|
169 | argspec = inspect.getargspec(self._func) | |
170 | arglist = argspec[0][1:] |
|
170 | arglist = argspec[0][1:] | |
171 |
defaults = |
|
171 | defaults = [type(arg) for arg in argspec[3] or []] | |
172 | default_empty = type(NotImplemented) |
|
172 | default_empty = type(NotImplemented) | |
173 |
|
173 | |||
174 | # kw arguments required by this method |
|
174 | # kw arguments required by this method |
@@ -100,7 +100,7 b' class FeedController(BaseRepoController)' | |||||
100 | desc_msg.append('\n\n') |
|
100 | desc_msg.append('\n\n') | |
101 | desc_msg.append(raw_diff) |
|
101 | desc_msg.append(raw_diff) | |
102 | desc_msg.append('</pre>') |
|
102 | desc_msg.append('</pre>') | |
103 |
return |
|
103 | return [safe_unicode(chunk) for chunk in desc_msg] | |
104 |
|
104 | |||
105 | def _feed(self, repo_name, kind, feed_factory): |
|
105 | def _feed(self, repo_name, kind, feed_factory): | |
106 | """Produce a simple feed""" |
|
106 | """Produce a simple feed""" |
@@ -379,7 +379,7 b' def pygmentize_annotation(repo_name, fil' | |||||
379 | h %= 1 |
|
379 | h %= 1 | |
380 | HSV_tuple = [h, 0.95, 0.95] |
|
380 | HSV_tuple = [h, 0.95, 0.95] | |
381 | RGB_tuple = hsv_to_rgb(*HSV_tuple) |
|
381 | RGB_tuple = hsv_to_rgb(*HSV_tuple) | |
382 |
yield |
|
382 | yield [str(int(x * 256)) for x in RGB_tuple] | |
383 |
|
383 | |||
384 | cgenerator = gen_color() |
|
384 | cgenerator = gen_color() | |
385 |
|
385 |
@@ -78,7 +78,7 b' class WhooshIndexingDaemon(object):' | |||||
78 | # filter repo list |
|
78 | # filter repo list | |
79 | if repo_list: |
|
79 | if repo_list: | |
80 | # Fix non-ascii repo names to unicode |
|
80 | # Fix non-ascii repo names to unicode | |
81 |
repo_list = |
|
81 | repo_list = set(safe_unicode(repo_name) for repo_name in repo_list) | |
82 | self.filtered_repo_paths = {} |
|
82 | self.filtered_repo_paths = {} | |
83 | for repo_name, repo in self.repo_paths.items(): |
|
83 | for repo_name, repo in self.repo_paths.items(): | |
84 | if repo_name in repo_list: |
|
84 | if repo_name in repo_list: |
@@ -47,7 +47,7 b' class GitInMemoryChangeset(BaseInMemoryC' | |||||
47 | for node in self.added + self.changed: |
|
47 | for node in self.added + self.changed: | |
48 | # Compute subdirs if needed |
|
48 | # Compute subdirs if needed | |
49 | dirpath, nodename = posixpath.split(node.path) |
|
49 | dirpath, nodename = posixpath.split(node.path) | |
50 |
dirnames = |
|
50 | dirnames = safe_str(dirpath).split('/') if dirpath else [] | |
51 | parent = commit_tree |
|
51 | parent = commit_tree | |
52 | ancestors = [('', parent)] |
|
52 | ancestors = [('', parent)] | |
53 |
|
53 |
@@ -27,7 +27,7 b' class MercurialChangeset(BaseChangeset):' | |||||
27 |
|
27 | |||
28 | @LazyProperty |
|
28 | @LazyProperty | |
29 | def tags(self): |
|
29 | def tags(self): | |
30 |
return |
|
30 | return [safe_unicode(tag) for tag in self._ctx.tags()] | |
31 |
|
31 | |||
32 | @LazyProperty |
|
32 | @LazyProperty | |
33 | def branch(self): |
|
33 | def branch(self): | |
@@ -95,7 +95,7 b' class MercurialChangeset(BaseChangeset):' | |||||
95 |
|
95 | |||
96 | @LazyProperty |
|
96 | @LazyProperty | |
97 | def bookmarks(self): |
|
97 | def bookmarks(self): | |
98 |
return |
|
98 | return [safe_unicode(bookmark) for bookmark in self._ctx.bookmarks()] | |
99 |
|
99 | |||
100 | @LazyProperty |
|
100 | @LazyProperty | |
101 | def message(self): |
|
101 | def message(self): |
@@ -1163,7 +1163,7 b' class Repository(Base, BaseDbModel):' | |||||
1163 | # names in the database, but that eventually needs to be converted |
|
1163 | # names in the database, but that eventually needs to be converted | |
1164 | # into a valid system path |
|
1164 | # into a valid system path | |
1165 | p += self.repo_name.split(Repository.url_sep()) |
|
1165 | p += self.repo_name.split(Repository.url_sep()) | |
1166 |
return os.path.join(* |
|
1166 | return os.path.join(*(safe_unicode(d) for d in p)) | |
1167 |
|
1167 | |||
1168 | @property |
|
1168 | @property | |
1169 | def cache_keys(self): |
|
1169 | def cache_keys(self): | |
@@ -2511,8 +2511,7 b' class Gist(Base, BaseDbModel):' | |||||
2511 | def scm_instance(self): |
|
2511 | def scm_instance(self): | |
2512 | from kallithea.lib.vcs import get_repo |
|
2512 | from kallithea.lib.vcs import get_repo | |
2513 | base_path = self.base_path() |
|
2513 | base_path = self.base_path() | |
2514 |
return get_repo(os.path.join( |
|
2514 | return get_repo(os.path.join(safe_str(base_path), safe_str(self.gist_access_id))) | |
2515 | [base_path, self.gist_access_id]))) |
|
|||
2516 |
|
2515 | |||
2517 |
|
2516 | |||
2518 | class UserSshKeys(Base, BaseDbModel): |
|
2517 | class UserSshKeys(Base, BaseDbModel): |
@@ -73,8 +73,7 b' class PermissionModel(object):' | |||||
73 | return '.'.join(perm_name.split('.')[:1]) |
|
73 | return '.'.join(perm_name.split('.')[:1]) | |
74 |
|
74 | |||
75 | perms = UserToPerm.query().filter(UserToPerm.user == user).all() |
|
75 | perms = UserToPerm.query().filter(UserToPerm.user == user).all() | |
76 |
defined_perms_groups = |
|
76 | defined_perms_groups = set(_get_group(x.permission.permission_name) for x in perms) | |
77 | (x.permission.permission_name for x in perms)) |
|
|||
78 | log.debug('GOT ALREADY DEFINED:%s', perms) |
|
77 | log.debug('GOT ALREADY DEFINED:%s', perms) | |
79 | DEFAULT_PERMS = Permission.DEFAULT_USER_PERMISSIONS |
|
78 | DEFAULT_PERMS = Permission.DEFAULT_USER_PERMISSIONS | |
80 |
|
79 |
@@ -644,7 +644,7 b' class RepoModel(object):' | |||||
644 | else: |
|
644 | else: | |
645 | _paths = [self.repos_path, new_parent_path, repo_name] |
|
645 | _paths = [self.repos_path, new_parent_path, repo_name] | |
646 | # we need to make it str for mercurial |
|
646 | # we need to make it str for mercurial | |
647 |
repo_path = os.path.join(* |
|
647 | repo_path = os.path.join(*(safe_str(x) for x in _paths)) | |
648 |
|
648 | |||
649 | # check if this path is not a repository |
|
649 | # check if this path is not a repository | |
650 | if is_valid_repo(repo_path, self.repos_path): |
|
650 | if is_valid_repo(repo_path, self.repos_path): |
General Comments 0
You need to be logged in to leave comments.
Login now