Show More
@@ -237,7 +237,7 b' class TestAdminSettingsGlobal(object):' | |||
|
237 | 237 | app_settings = SettingsModel().get_all_settings() |
|
238 | 238 | del settings['csrf_token'] |
|
239 | 239 | for key, value in settings.items(): |
|
240 |
assert app_settings[key] == value |
|
|
240 | assert app_settings[key] == value | |
|
241 | 241 | |
|
242 | 242 | return response |
|
243 | 243 |
@@ -442,7 +442,7 b' class AdminSettingsView(BaseAppView):' | |||
|
442 | 442 | 'repo_group/test_repo1', error_container=error_container) |
|
443 | 443 | if error_container: |
|
444 | 444 | def converter(inp): |
|
445 |
return h.html_escape( |
|
|
445 | return h.html_escape(inp) | |
|
446 | 446 | |
|
447 | 447 | return 'ERRORS: ' + '\n'.join(map(converter, error_container)) |
|
448 | 448 |
@@ -81,8 +81,6 b' class SettingsMaker(object):' | |||
|
81 | 81 | |
|
82 | 82 | @classmethod |
|
83 | 83 | def _bool_func(cls, input_val): |
|
84 | if isinstance(input_val, str): | |
|
85 | input_val = input_val.encode('utf8') | |
|
86 | 84 | return str2bool(input_val) |
|
87 | 85 | |
|
88 | 86 | @classmethod |
@@ -273,7 +273,7 b' class WerkzeugAdapter(BaseAdapter):' | |||
|
273 | 273 | self.response = response |
|
274 | 274 | |
|
275 | 275 | def write(self, value): |
|
276 |
self.response.data = self.response.data |
|
|
276 | self.response.data = self.response.data + value | |
|
277 | 277 | |
|
278 | 278 | def set_header(self, key, value): |
|
279 | 279 | self.response.headers[key] = value |
@@ -1156,7 +1156,7 b' class Response(ReprMixin):' | |||
|
1156 | 1156 | if self.is_binary_string(content): |
|
1157 | 1157 | self._content = content |
|
1158 | 1158 | else: |
|
1159 |
self._content = content |
|
|
1159 | self._content = content | |
|
1160 | 1160 | return self._content |
|
1161 | 1161 | |
|
1162 | 1162 | @property |
@@ -298,7 +298,7 b' class OAuth2(providers.AuthorizationProv' | |||
|
298 | 298 | # unquote Cast to str to void b64decode translation error. Base64 |
|
299 | 299 | # should be str compatible. |
|
300 | 300 | return json.loads(base64.urlsafe_b64decode( |
|
301 |
unquote(str(state))) |
|
|
301 | unquote(str(state))))[param] | |
|
302 | 302 | else: |
|
303 | 303 | return state if param == 'csrf' else '' |
|
304 | 304 |
@@ -156,7 +156,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
156 | 156 | |
|
157 | 157 | @validates('_app_settings_value') |
|
158 | 158 | def validate_settings_value(self, key, val): |
|
159 |
assert type(val) == |
|
|
159 | assert type(val) == str | |
|
160 | 160 | return val |
|
161 | 161 | |
|
162 | 162 | @hybrid_property |
@@ -178,7 +178,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
178 | 178 | |
|
179 | 179 | @validates('_app_settings_value') |
|
180 | 180 | def validate_settings_value(self, key, val): |
|
181 |
assert type(val) == |
|
|
181 | assert type(val) == str | |
|
182 | 182 | return val |
|
183 | 183 | |
|
184 | 184 | @hybrid_property |
@@ -57,7 +57,6 b' def rfc2822_date(date):' | |||
|
57 | 57 | month = months[date.month - 1] |
|
58 | 58 | time_str = date.strftime('%s, %%d %s %%Y %%H:%%M:%%S ' % (dow, month)) |
|
59 | 59 | |
|
60 | time_str = time_str.decode('utf-8') | |
|
61 | 60 | offset = date.utcoffset() |
|
62 | 61 | # Historically, this function assumes that naive datetimes are in UTC. |
|
63 | 62 | if offset is None: |
@@ -73,7 +72,6 b' def rfc3339_date(date):' | |||
|
73 | 72 | date = datetime_safe.new_datetime(date) |
|
74 | 73 | time_str = date.strftime('%Y-%m-%dT%H:%M:%S') |
|
75 | 74 | |
|
76 | time_str = time_str.decode('utf-8') | |
|
77 | 75 | offset = date.utcoffset() |
|
78 | 76 | # Historically, this function assumes that naive datetimes are in UTC. |
|
79 | 77 | if offset is None: |
@@ -1441,7 +1441,7 b' def gravatar_url(email_address, size=30,' | |||
|
1441 | 1441 | _use_gravatar = request.call_context.visual.use_gravatar |
|
1442 | 1442 | |
|
1443 | 1443 | email_address = email_address or User.DEFAULT_USER_EMAIL |
|
1444 |
if isinstance(email_address, |
|
|
1444 | if isinstance(email_address, str): | |
|
1445 | 1445 | # hashlib crashes on unicode items |
|
1446 | 1446 | email_address = safe_str(email_address) |
|
1447 | 1447 |
@@ -79,7 +79,7 b' class HooksHttpHandler(BaseHTTPRequestHa' | |||
|
79 | 79 | # support for new vcsserver msgpack based protocol hooks |
|
80 | 80 | data = msgpack.unpackb(self.rfile.read(length), raw=False) |
|
81 | 81 | else: |
|
82 |
body = self.rfile.read(length) |
|
|
82 | body = self.rfile.read(length) | |
|
83 | 83 | data = json.loads(body) |
|
84 | 84 | |
|
85 | 85 | return hooks_proto, data['method'], data['extras'] |
@@ -285,7 +285,7 b' class InvalidationContext(object):' | |||
|
285 | 285 | self.uid = uid |
|
286 | 286 | self.invalidation_namespace = invalidation_namespace |
|
287 | 287 | self.raise_exception = raise_exception |
|
288 |
self.proc_id = |
|
|
288 | self.proc_id = rhodecode.CONFIG.get('instance_id') or 'DEFAULT' | |
|
289 | 289 | self.thread_id = 'global' |
|
290 | 290 | |
|
291 | 291 | if thread_scoped is None: |
@@ -240,7 +240,7 b' class GitRepository(BaseRepository):' | |||
|
240 | 240 | commit_missing_err = "Commit {} does not exist for `{}`".format( |
|
241 | 241 | *map(safe_str, [commit_id_or_idx, self.name])) |
|
242 | 242 | |
|
243 |
is_bstr = isinstance(commit_id_or_idx, |
|
|
243 | is_bstr = isinstance(commit_id_or_idx, str) | |
|
244 | 244 | is_branch = reference_obj and reference_obj.branch |
|
245 | 245 | |
|
246 | 246 | lookup_ok = False |
@@ -180,7 +180,7 b' def _stub_git_repo(repo_path):' | |||
|
180 | 180 | repo_path.ensure('.git', dir=True) |
|
181 | 181 | |
|
182 | 182 | |
|
183 |
@pytest.mark.parametrize('str_class', [str, |
|
|
183 | @pytest.mark.parametrize('str_class', [str, bytes], ids=['str', 'bytes']) | |
|
184 | 184 | def test_get_dirpaths_returns_all_paths(tmpdir, str_class): |
|
185 | 185 | tmpdir.ensure('test-file') |
|
186 | 186 | dirpaths = utils._get_dirpaths(str_class(tmpdir)) |
@@ -162,7 +162,7 b' def test_get_nodes_max_file_bytes(backen' | |||
|
162 | 162 | def assert_contains_only_unicode(structure): |
|
163 | 163 | assert structure |
|
164 | 164 | for value in structure: |
|
165 |
assert isinstance(value, |
|
|
165 | assert isinstance(value, str) | |
|
166 | 166 | |
|
167 | 167 | |
|
168 | 168 | @pytest.mark.backends("hg", "git") |
@@ -69,6 +69,12 b' from rhodecode.config import utils as co' | |||
|
69 | 69 | |
|
70 | 70 | log = logging.getLogger(__name__) |
|
71 | 71 | |
|
72 | ||
|
73 | def cmp(a, b): | |
|
74 | # backport cmp from python2 so we can still use it in the custom code in this module | |
|
75 | return (a > b) - (a < b) | |
|
76 | ||
|
77 | ||
|
72 | 78 | def _split_comma(value): |
|
73 | 79 | return value.split(',') |
|
74 | 80 | |
@@ -872,7 +878,7 b' def _add_commits_to_repo(vcs_repo, commi' | |||
|
872 | 878 | commit = None |
|
873 | 879 | |
|
874 | 880 | for idx, commit in enumerate(commits): |
|
875 |
message = |
|
|
881 | message = str(commit.get('message', 'Commit %s' % idx)) | |
|
876 | 882 | |
|
877 | 883 | for node in commit.get('added', []): |
|
878 | 884 | imc.add(FileNode(node.path, content=node.content)) |
@@ -891,7 +897,7 b' def _add_commits_to_repo(vcs_repo, commi' | |||
|
891 | 897 | |
|
892 | 898 | commit = imc.commit( |
|
893 | 899 | message=message, |
|
894 |
author= |
|
|
900 | author=str(commit.get('author', 'Automatic <automatic@rhodecode.com>')), | |
|
895 | 901 | date=commit.get('date'), |
|
896 | 902 | branch=commit.get('branch'), |
|
897 | 903 | parents=parents) |
@@ -592,5 +592,5 b' class TestCommitsChanges(BackendTestMixi' | |||
|
592 | 592 | |
|
593 | 593 | def assert_text_equal(expected, given): |
|
594 | 594 | assert expected == given |
|
595 |
assert isinstance(expected, |
|
|
596 |
assert isinstance(given, |
|
|
595 | assert isinstance(expected, str) | |
|
596 | assert isinstance(given, str) |
@@ -29,7 +29,7 b' from rhodecode.tests.vcs.conftest import' | |||
|
29 | 29 | class TestFileNodeUnicodePath(BackendTestMixin): |
|
30 | 30 | |
|
31 | 31 | fname = 'ąśðąęłąć.txt' |
|
32 |
ufname = |
|
|
32 | ufname = fname | |
|
33 | 33 | |
|
34 | 34 | @classmethod |
|
35 | 35 | def _get_commits(cls): |
@@ -965,17 +965,17 b' class TestGitCommit(object):' | |||
|
965 | 965 | |
|
966 | 966 | def test_commit_message_is_unicode(self): |
|
967 | 967 | for commit in self.repo: |
|
968 |
assert type(commit.message) == |
|
|
968 | assert type(commit.message) == str | |
|
969 | 969 | |
|
970 | 970 | def test_commit_author_is_unicode(self): |
|
971 | 971 | for commit in self.repo: |
|
972 |
assert type(commit.author) == |
|
|
972 | assert type(commit.author) == str | |
|
973 | 973 | |
|
974 | 974 | def test_repo_files_content_is_unicode(self): |
|
975 | 975 | commit = self.repo.get_commit() |
|
976 | 976 | for node in commit.get_node('/'): |
|
977 | 977 | if node.is_file(): |
|
978 |
assert type(node.content) == |
|
|
978 | assert type(node.content) == str | |
|
979 | 979 | |
|
980 | 980 | def test_wrong_path(self): |
|
981 | 981 | # There is 'setup.py' in the root dir but not there: |
@@ -1084,17 +1084,17 b' class TestMercurialCommit(object):' | |||
|
1084 | 1084 | |
|
1085 | 1085 | def test_commit_message_is_unicode(self): |
|
1086 | 1086 | for cm in self.repo: |
|
1087 |
assert type(cm.message) == |
|
|
1087 | assert type(cm.message) == str | |
|
1088 | 1088 | |
|
1089 | 1089 | def test_commit_author_is_unicode(self): |
|
1090 | 1090 | for cm in self.repo: |
|
1091 |
assert type(cm.author) == |
|
|
1091 | assert type(cm.author) == str | |
|
1092 | 1092 | |
|
1093 | 1093 | def test_repo_files_content_is_unicode(self): |
|
1094 | 1094 | test_commit = self.repo.get_commit(commit_idx=100) |
|
1095 | 1095 | for node in test_commit.get_node('/'): |
|
1096 | 1096 | if node.is_file(): |
|
1097 |
assert type(node.content) == |
|
|
1097 | assert type(node.content) == str | |
|
1098 | 1098 | |
|
1099 | 1099 | def test_wrong_path(self): |
|
1100 | 1100 | # There is 'setup.py' in the root dir but not there: |
General Comments 0
You need to be logged in to leave comments.
Login now