Show More
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | from sqlalchemy.util import OrderedDict |
|
5 | 5 |
@@ -68,7 +68,7 b' class ModelGenerator(object):' | |||
|
68 | 68 | |
|
69 | 69 | # crs: not sure if this is good idea, but it gets rid of extra |
|
70 | 70 | # u'' |
|
71 | name = col.name.encode('utf8') | |
|
71 | name = col.name#.encode('utf8') | |
|
72 | 72 | |
|
73 | 73 | type_ = col.type |
|
74 | 74 | for cls in col.type.__class__.__mro__: |
@@ -4,8 +4,7 b'' | |||
|
4 | 4 | import sys |
|
5 | 5 | import logging |
|
6 | 6 | |
|
7 | from sqlalchemy import (Table, Column, MetaData, String, Text, Integer, | |
|
8 | create_engine) | |
|
7 | from sqlalchemy import (Table, Column, MetaData, String, Text, Integer, create_engine) | |
|
9 | 8 | from sqlalchemy.sql import and_ |
|
10 | 9 | from sqlalchemy import exc as sa_exceptions |
|
11 | 10 | from sqlalchemy.sql import bindparam |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | from rhodecode.lib.dbmigrate.migrate.versioning.script.base import BaseScript |
|
5 | 5 | from rhodecode.lib.dbmigrate.migrate.versioning.script.py import PythonScript |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | import logging |
|
4 | 4 | |
|
5 | 5 | from rhodecode.lib.dbmigrate.migrate import exceptions |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | import shutil |
|
5 | 5 | import warnings |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | import logging |
|
4 | 4 | import shutil |
|
5 | 5 |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | """The migrate command-line tool.""" |
|
5 | 5 |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | import os |
|
5 | 5 | import shutil |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | """.. currentmodule:: migrate.versioning.util""" |
|
4 | 4 | |
|
5 | 5 | import warnings |
@@ -125,8 +125,8 b' def construct_engine(engine, **opts):' | |||
|
125 | 125 | # DEPRECATED: handle echo the old way |
|
126 | 126 | echo = asbool(opts.get('echo', False)) |
|
127 | 127 | if echo: |
|
128 | warnings.warn('echo=True parameter is deprecated, pass ' | |
|
129 | 'engine_arg_echo=True or engine_dict={"echo": True}', | |
|
128 | warnings.warn( | |
|
129 | 'echo=True parameter is deprecated, pass engine_arg_echo=True or engine_dict={"echo": True}', | |
|
130 | 130 | exceptions.MigrateDeprecationWarning) |
|
131 | 131 | kwargs['echo'] = echo |
|
132 | 132 |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | class KeyedInstance(object): |
|
5 | 5 | """A class whose instances have a unique identifier of some sort |
@@ -1,5 +1,5 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 3 | |
|
4 | 4 | import os |
|
5 | 5 | import re |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -34,7 +33,7 b' from rhodecode.lib.vcs.utils.helpers imp' | |||
|
34 | 33 | from rhodecode.lib.vcs.exceptions import VCSError |
|
35 | 34 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
36 | 35 | from rhodecode.lib.auth import generate_auth_token |
|
37 |
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe |
|
|
36 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe | |
|
38 | 37 | from rhodecode.lib.exceptions import UserGroupAssignedException |
|
39 | 38 | from rhodecode.lib.ext_json import json |
|
40 | 39 | |
@@ -147,7 +146,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
147 | 146 | |
|
148 | 147 | @validates('_app_settings_value') |
|
149 | 148 | def validate_settings_value(self, key, val): |
|
150 |
assert type(val) == |
|
|
149 | assert type(val) == str | |
|
151 | 150 | return val |
|
152 | 151 | |
|
153 | 152 | @hybrid_property |
@@ -164,7 +163,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
164 | 163 | |
|
165 | 164 | :param val: |
|
166 | 165 | """ |
|
167 |
self._app_settings_value = safe_ |
|
|
166 | self._app_settings_value = safe_str(val) | |
|
168 | 167 | |
|
169 | 168 | def __repr__(self): |
|
170 | 169 | return "<%s('%s:%s')>" % (self.__class__.__name__, |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -34,8 +33,7 b' from rhodecode.lib.vcs.utils.helpers imp' | |||
|
34 | 33 | from rhodecode.lib.vcs.exceptions import VCSError |
|
35 | 34 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
36 | 35 | |
|
37 |
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe |
|
|
38 | safe_unicode | |
|
36 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe | |
|
39 | 37 | from rhodecode.lib.ext_json import json |
|
40 | 38 | from rhodecode.lib.caching_query import FromCache |
|
41 | 39 | |
@@ -165,7 +163,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
165 | 163 | |
|
166 | 164 | @validates('_app_settings_value') |
|
167 | 165 | def validate_settings_value(self, key, val): |
|
168 |
assert type(val) == |
|
|
166 | assert type(val) == str | |
|
169 | 167 | return val |
|
170 | 168 | |
|
171 | 169 | @hybrid_property |
@@ -182,7 +180,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
182 | 180 | |
|
183 | 181 | :param val: |
|
184 | 182 | """ |
|
185 |
self._app_settings_value = safe_ |
|
|
183 | self._app_settings_value = safe_str(val) | |
|
186 | 184 | |
|
187 | 185 | def __unicode__(self): |
|
188 | 186 | return u"<%s('%s:%s')>" % ( |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -40,8 +39,7 b' from rhodecode.lib.vcs.utils.helpers imp' | |||
|
40 | 39 | from rhodecode.lib.vcs.exceptions import VCSError |
|
41 | 40 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
42 | 41 | |
|
43 |
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, |
|
|
44 | safe_unicode, remove_suffix | |
|
42 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, remove_suffix | |
|
45 | 43 | from rhodecode.lib.ext_json import json |
|
46 | 44 | from rhodecode.lib.caching_query import FromCache |
|
47 | 45 | |
@@ -173,7 +171,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
173 | 171 | |
|
174 | 172 | :param val: |
|
175 | 173 | """ |
|
176 |
self._app_settings_value = safe_ |
|
|
174 | self._app_settings_value = safe_str(val) | |
|
177 | 175 | |
|
178 | 176 | def __unicode__(self): |
|
179 | 177 | return u"<%s('%s:%s')>" % ( |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -41,8 +40,7 b' from rhodecode.lib.vcs.utils.helpers imp' | |||
|
41 | 40 | from rhodecode.lib.vcs.exceptions import VCSError |
|
42 | 41 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
43 | 42 | |
|
44 |
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, |
|
|
45 | safe_unicode, remove_suffix, remove_prefix | |
|
43 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, remove_suffix, remove_prefix | |
|
46 | 44 | from rhodecode.lib.ext_json import json |
|
47 | 45 | from rhodecode.lib.caching_query import FromCache |
|
48 | 46 | |
@@ -162,7 +160,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
162 | 160 | |
|
163 | 161 | @validates('_app_settings_value') |
|
164 | 162 | def validate_settings_value(self, key, val): |
|
165 |
assert type(val) == |
|
|
163 | assert type(val) == str | |
|
166 | 164 | return val |
|
167 | 165 | |
|
168 | 166 | @hybrid_property |
@@ -183,7 +181,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
183 | 181 | |
|
184 | 182 | :param val: |
|
185 | 183 | """ |
|
186 |
self._app_settings_value = safe_ |
|
|
184 | self._app_settings_value = safe_str(val) | |
|
187 | 185 | |
|
188 | 186 | def __unicode__(self): |
|
189 | 187 | return u"<%s('%s:%s')>" % ( |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -41,8 +40,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
41 | 40 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
42 | 41 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
43 | 42 | |
|
44 |
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, |
|
|
45 | safe_unicode, remove_suffix, remove_prefix | |
|
43 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, remove_suffix, remove_prefix | |
|
46 | 44 | from rhodecode.lib.ext_json import json |
|
47 | 45 | from rhodecode.lib.caching_query import FromCache |
|
48 | 46 | |
@@ -162,7 +160,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
162 | 160 | |
|
163 | 161 | @validates('_app_settings_value') |
|
164 | 162 | def validate_settings_value(self, key, val): |
|
165 |
assert type(val) == |
|
|
163 | assert type(val) == str | |
|
166 | 164 | return val |
|
167 | 165 | |
|
168 | 166 | @hybrid_property |
@@ -183,7 +181,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
183 | 181 | |
|
184 | 182 | :param val: |
|
185 | 183 | """ |
|
186 |
self._app_settings_value = safe_ |
|
|
184 | self._app_settings_value = safe_str(val) | |
|
187 | 185 | |
|
188 | 186 | def __unicode__(self): |
|
189 | 187 | return u"<%s('%s:%s')>" % ( |
@@ -527,7 +525,7 b' class Repository(Base, BaseModel):' | |||
|
527 | 525 | |
|
528 | 526 | def __unicode__(self): |
|
529 | 527 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
530 |
safe_ |
|
|
528 | safe_str(self.repo_name)) | |
|
531 | 529 | |
|
532 | 530 | |
|
533 | 531 | @classmethod |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -42,7 +41,7 b' from zope.cachedescriptors.property impo' | |||
|
42 | 41 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
43 | 42 | |
|
44 | 43 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
45 |
|
|
|
44 | remove_suffix, remove_prefix, time_to_datetime | |
|
46 | 45 | from rhodecode.lib.ext_json import json |
|
47 | 46 | from rhodecode.lib.caching_query import FromCache |
|
48 | 47 | |
@@ -162,7 +161,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
162 | 161 | |
|
163 | 162 | @validates('_app_settings_value') |
|
164 | 163 | def validate_settings_value(self, key, val): |
|
165 |
assert type(val) == |
|
|
164 | assert type(val) == str | |
|
166 | 165 | return val |
|
167 | 166 | |
|
168 | 167 | @hybrid_property |
@@ -183,7 +182,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
183 | 182 | |
|
184 | 183 | :param val: |
|
185 | 184 | """ |
|
186 |
self._app_settings_value = safe_ |
|
|
185 | self._app_settings_value = safe_str(val) | |
|
187 | 186 | |
|
188 | 187 | def __unicode__(self): |
|
189 | 188 | return u"<%s('%s:%s')>" % ( |
@@ -557,7 +556,7 b' class Repository(Base, BaseModel):' | |||
|
557 | 556 | |
|
558 | 557 | def __unicode__(self): |
|
559 | 558 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
560 |
safe_ |
|
|
559 | safe_str(self.repo_name)) | |
|
561 | 560 | |
|
562 | 561 | #NOTE for this migration we are required tio have it |
|
563 | 562 | @hybrid_property |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -42,7 +41,7 b' from zope.cachedescriptors.property impo' | |||
|
42 | 41 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
43 | 42 | |
|
44 | 43 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
45 |
|
|
|
44 | remove_suffix, remove_prefix, time_to_datetime | |
|
46 | 45 | from rhodecode.lib.ext_json import json |
|
47 | 46 | from rhodecode.lib.caching_query import FromCache |
|
48 | 47 | |
@@ -162,7 +161,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
162 | 161 | |
|
163 | 162 | @validates('_app_settings_value') |
|
164 | 163 | def validate_settings_value(self, key, val): |
|
165 |
assert type(val) == |
|
|
164 | assert type(val) == str | |
|
166 | 165 | return val |
|
167 | 166 | |
|
168 | 167 | @hybrid_property |
@@ -183,7 +182,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
183 | 182 | |
|
184 | 183 | :param val: |
|
185 | 184 | """ |
|
186 |
self._app_settings_value = safe_ |
|
|
185 | self._app_settings_value = safe_str(val) | |
|
187 | 186 | |
|
188 | 187 | def __unicode__(self): |
|
189 | 188 | return u"<%s('%s:%s')>" % ( |
@@ -582,7 +581,7 b' class Repository(Base, BaseModel):' | |||
|
582 | 581 | |
|
583 | 582 | def __unicode__(self): |
|
584 | 583 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
585 |
safe_ |
|
|
584 | safe_str(self.repo_name)) | |
|
586 | 585 | |
|
587 | 586 | @classmethod |
|
588 | 587 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -42,7 +41,7 b' from zope.cachedescriptors.property impo' | |||
|
42 | 41 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
43 | 42 | |
|
44 | 43 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
45 |
|
|
|
44 | remove_suffix, remove_prefix, time_to_datetime | |
|
46 | 45 | from rhodecode.lib.ext_json import json |
|
47 | 46 | from rhodecode.lib.caching_query import FromCache |
|
48 | 47 | |
@@ -164,7 +163,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
164 | 163 | |
|
165 | 164 | @validates('_app_settings_value') |
|
166 | 165 | def validate_settings_value(self, key, val): |
|
167 |
assert type(val) == |
|
|
166 | assert type(val) == str | |
|
168 | 167 | return val |
|
169 | 168 | |
|
170 | 169 | @hybrid_property |
@@ -185,7 +184,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
185 | 184 | |
|
186 | 185 | :param val: |
|
187 | 186 | """ |
|
188 |
self._app_settings_value = safe_ |
|
|
187 | self._app_settings_value = safe_str(val) | |
|
189 | 188 | |
|
190 | 189 | def __unicode__(self): |
|
191 | 190 | return u"<%s('%s:%s')>" % ( |
@@ -584,7 +583,7 b' class Repository(Base, BaseModel):' | |||
|
584 | 583 | |
|
585 | 584 | def __unicode__(self): |
|
586 | 585 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
587 |
safe_ |
|
|
586 | safe_str(self.repo_name)) | |
|
588 | 587 | |
|
589 | 588 | @classmethod |
|
590 | 589 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int | |
|
47 | 46 | from rhodecode.lib.ext_json import json |
|
48 | 47 | from rhodecode.lib.caching_query import FromCache |
|
49 | 48 | |
@@ -150,7 +149,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
150 | 149 | SETTINGS_TYPES = { |
|
151 | 150 | 'str': safe_str, |
|
152 | 151 | 'int': safe_int, |
|
153 |
'unicode': safe_ |
|
|
152 | 'unicode': safe_str, | |
|
154 | 153 | 'bool': str2bool, |
|
155 | 154 | 'list': functools.partial(aslist, sep=',') |
|
156 | 155 | } |
@@ -172,7 +171,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
172 | 171 | |
|
173 | 172 | @validates('_app_settings_value') |
|
174 | 173 | def validate_settings_value(self, key, val): |
|
175 |
assert type(val) == |
|
|
174 | assert type(val) == str | |
|
176 | 175 | return val |
|
177 | 176 | |
|
178 | 177 | @hybrid_property |
@@ -189,7 +188,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
189 | 188 | |
|
190 | 189 | :param val: |
|
191 | 190 | """ |
|
192 |
self._app_settings_value = safe_ |
|
|
191 | self._app_settings_value = safe_str(val) | |
|
193 | 192 | |
|
194 | 193 | @hybrid_property |
|
195 | 194 | def app_settings_type(self): |
@@ -607,7 +606,7 b' class Repository(Base, BaseModel):' | |||
|
607 | 606 | |
|
608 | 607 | def __unicode__(self): |
|
609 | 608 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
610 |
safe_ |
|
|
609 | safe_str(self.repo_name)) | |
|
611 | 610 | |
|
612 | 611 | @classmethod |
|
613 | 612 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int | |
|
47 | 46 | from rhodecode.lib.ext_json import json |
|
48 | 47 | from rhodecode.lib.caching_query import FromCache |
|
49 | 48 | |
@@ -153,7 +152,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
153 | 152 | SETTINGS_TYPES = { |
|
154 | 153 | 'str': safe_str, |
|
155 | 154 | 'int': safe_int, |
|
156 |
'unicode': safe_ |
|
|
155 | 'unicode': safe_str, | |
|
157 | 156 | 'bool': str2bool, |
|
158 | 157 | 'list': functools.partial(aslist, sep=',') |
|
159 | 158 | } |
@@ -175,7 +174,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
175 | 174 | |
|
176 | 175 | @validates('_app_settings_value') |
|
177 | 176 | def validate_settings_value(self, key, val): |
|
178 |
assert type(val) == |
|
|
177 | assert type(val) == str | |
|
179 | 178 | return val |
|
180 | 179 | |
|
181 | 180 | @hybrid_property |
@@ -192,7 +191,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
192 | 191 | |
|
193 | 192 | :param val: |
|
194 | 193 | """ |
|
195 |
self._app_settings_value = safe_ |
|
|
194 | self._app_settings_value = safe_str(val) | |
|
196 | 195 | |
|
197 | 196 | @hybrid_property |
|
198 | 197 | def app_settings_type(self): |
@@ -606,7 +605,7 b' class Repository(Base, BaseModel):' | |||
|
606 | 605 | |
|
607 | 606 | def __unicode__(self): |
|
608 | 607 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
609 |
safe_ |
|
|
608 | safe_str(self.repo_name)) | |
|
610 | 609 | |
|
611 | 610 | @classmethod |
|
612 | 611 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int | |
|
47 | 46 | from rhodecode.lib.ext_json import json |
|
48 | 47 | from rhodecode.lib.caching_query import FromCache |
|
49 | 48 | |
@@ -153,7 +152,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
153 | 152 | SETTINGS_TYPES = { |
|
154 | 153 | 'str': safe_str, |
|
155 | 154 | 'int': safe_int, |
|
156 |
'unicode': safe_ |
|
|
155 | 'unicode': safe_str, | |
|
157 | 156 | 'bool': str2bool, |
|
158 | 157 | 'list': functools.partial(aslist, sep=',') |
|
159 | 158 | } |
@@ -175,7 +174,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
175 | 174 | |
|
176 | 175 | @validates('_app_settings_value') |
|
177 | 176 | def validate_settings_value(self, key, val): |
|
178 |
assert type(val) == |
|
|
177 | assert type(val) == str | |
|
179 | 178 | return val |
|
180 | 179 | |
|
181 | 180 | @hybrid_property |
@@ -192,7 +191,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
192 | 191 | |
|
193 | 192 | :param val: |
|
194 | 193 | """ |
|
195 |
self._app_settings_value = safe_ |
|
|
194 | self._app_settings_value = safe_str(val) | |
|
196 | 195 | |
|
197 | 196 | @hybrid_property |
|
198 | 197 | def app_settings_type(self): |
@@ -624,7 +623,7 b' class Repository(Base, BaseModel):' | |||
|
624 | 623 | |
|
625 | 624 | def __unicode__(self): |
|
626 | 625 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
627 |
safe_ |
|
|
626 | safe_str(self.repo_name)) | |
|
628 | 627 | |
|
629 | 628 | @classmethod |
|
630 | 629 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int | |
|
47 | 46 | from rhodecode.lib.ext_json import json |
|
48 | 47 | from rhodecode.lib.caching_query import FromCache |
|
49 | 48 | |
@@ -160,7 +159,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
160 | 159 | SETTINGS_TYPES = { |
|
161 | 160 | 'str': safe_str, |
|
162 | 161 | 'int': safe_int, |
|
163 |
'unicode': safe_ |
|
|
162 | 'unicode': safe_str, | |
|
164 | 163 | 'bool': str2bool, |
|
165 | 164 | 'list': functools.partial(aslist, sep=',') |
|
166 | 165 | } |
@@ -195,7 +194,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
195 | 194 | |
|
196 | 195 | :param val: |
|
197 | 196 | """ |
|
198 |
self._app_settings_value = safe_ |
|
|
197 | self._app_settings_value = safe_str(val) | |
|
199 | 198 | |
|
200 | 199 | @hybrid_property |
|
201 | 200 | def app_settings_type(self): |
@@ -641,7 +640,7 b' class Repository(Base, BaseModel):' | |||
|
641 | 640 | |
|
642 | 641 | def __unicode__(self): |
|
643 | 642 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
644 |
safe_ |
|
|
643 | safe_str(self.repo_name)) | |
|
645 | 644 | |
|
646 | 645 | @classmethod |
|
647 | 646 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int, \ | |
|
47 | 46 | get_clone_url |
|
48 | 47 | from rhodecode.lib.ext_json import json |
|
49 | 48 | from rhodecode.lib.caching_query import FromCache |
@@ -161,7 +160,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
161 | 160 | SETTINGS_TYPES = { |
|
162 | 161 | 'str': safe_str, |
|
163 | 162 | 'int': safe_int, |
|
164 |
'unicode': safe_ |
|
|
163 | 'unicode': safe_str, | |
|
165 | 164 | 'bool': str2bool, |
|
166 | 165 | 'list': functools.partial(aslist, sep=',') |
|
167 | 166 | } |
@@ -179,7 +178,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
179 | 178 | |
|
180 | 179 | @validates('_app_settings_value') |
|
181 | 180 | def validate_settings_value(self, key, val): |
|
182 |
assert type(val) == |
|
|
181 | assert type(val) == str | |
|
183 | 182 | return val |
|
184 | 183 | |
|
185 | 184 | @hybrid_property |
@@ -196,7 +195,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
196 | 195 | |
|
197 | 196 | :param val: |
|
198 | 197 | """ |
|
199 |
self._app_settings_value = safe_ |
|
|
198 | self._app_settings_value = safe_str(val) | |
|
200 | 199 | |
|
201 | 200 | @hybrid_property |
|
202 | 201 | def app_settings_type(self): |
@@ -657,7 +656,7 b' class Repository(Base, BaseModel):' | |||
|
657 | 656 | |
|
658 | 657 | def __unicode__(self): |
|
659 | 658 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
660 |
safe_ |
|
|
659 | safe_str(self.repo_name)) | |
|
661 | 660 | |
|
662 | 661 | @classmethod |
|
663 | 662 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int, \ | |
|
47 | 46 | get_clone_url |
|
48 | 47 | from rhodecode.lib.ext_json import json |
|
49 | 48 | from rhodecode.lib.caching_query import FromCache |
@@ -161,7 +160,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
161 | 160 | SETTINGS_TYPES = { |
|
162 | 161 | 'str': safe_str, |
|
163 | 162 | 'int': safe_int, |
|
164 |
'unicode': safe_ |
|
|
163 | 'unicode': safe_str, | |
|
165 | 164 | 'bool': str2bool, |
|
166 | 165 | 'list': functools.partial(aslist, sep=',') |
|
167 | 166 | } |
@@ -179,7 +178,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
179 | 178 | |
|
180 | 179 | @validates('_app_settings_value') |
|
181 | 180 | def validate_settings_value(self, key, val): |
|
182 |
assert type(val) == |
|
|
181 | assert type(val) == str | |
|
183 | 182 | return val |
|
184 | 183 | |
|
185 | 184 | @hybrid_property |
@@ -196,7 +195,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
196 | 195 | |
|
197 | 196 | :param val: |
|
198 | 197 | """ |
|
199 |
self._app_settings_value = safe_ |
|
|
198 | self._app_settings_value = safe_str(val) | |
|
200 | 199 | |
|
201 | 200 | @hybrid_property |
|
202 | 201 | def app_settings_type(self): |
@@ -660,7 +659,7 b' class Repository(Base, BaseModel):' | |||
|
660 | 659 | |
|
661 | 660 | def __unicode__(self): |
|
662 | 661 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
663 |
safe_ |
|
|
662 | safe_str(self.repo_name)) | |
|
664 | 663 | |
|
665 | 664 | @classmethod |
|
666 | 665 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int, \ | |
|
47 | 46 | get_clone_url |
|
48 | 47 | from rhodecode.lib.ext_json import json |
|
49 | 48 | from rhodecode.lib.caching_query import FromCache |
@@ -161,7 +160,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
161 | 160 | SETTINGS_TYPES = { |
|
162 | 161 | 'str': safe_str, |
|
163 | 162 | 'int': safe_int, |
|
164 |
'unicode': safe_ |
|
|
163 | 'unicode': safe_str, | |
|
165 | 164 | 'bool': str2bool, |
|
166 | 165 | 'list': functools.partial(aslist, sep=',') |
|
167 | 166 | } |
@@ -179,7 +178,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
179 | 178 | |
|
180 | 179 | @validates('_app_settings_value') |
|
181 | 180 | def validate_settings_value(self, key, val): |
|
182 |
assert type(val) == |
|
|
181 | assert type(val) == str | |
|
183 | 182 | return val |
|
184 | 183 | |
|
185 | 184 | @hybrid_property |
@@ -196,7 +195,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
196 | 195 | |
|
197 | 196 | :param val: |
|
198 | 197 | """ |
|
199 |
self._app_settings_value = safe_ |
|
|
198 | self._app_settings_value = safe_str(val) | |
|
200 | 199 | |
|
201 | 200 | @hybrid_property |
|
202 | 201 | def app_settings_type(self): |
@@ -664,7 +663,7 b' class Repository(Base, BaseModel):' | |||
|
664 | 663 | |
|
665 | 664 | def __unicode__(self): |
|
666 | 665 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
667 |
safe_ |
|
|
666 | safe_str(self.repo_name)) | |
|
668 | 667 | |
|
669 | 668 | @classmethod |
|
670 | 669 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -43,7 +42,7 b' from zope.cachedescriptors.property impo' | |||
|
43 | 42 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
44 | 43 | |
|
45 | 44 | from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \ |
|
46 |
|
|
|
45 | remove_prefix, time_to_datetime, aslist, Optional, safe_int, \ | |
|
47 | 46 | get_clone_url |
|
48 | 47 | from rhodecode.lib.ext_json import json |
|
49 | 48 | from rhodecode.lib.caching_query import FromCache |
@@ -161,7 +160,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
161 | 160 | SETTINGS_TYPES = { |
|
162 | 161 | 'str': safe_str, |
|
163 | 162 | 'int': safe_int, |
|
164 |
'unicode': safe_ |
|
|
163 | 'unicode': safe_str, | |
|
165 | 164 | 'bool': str2bool, |
|
166 | 165 | 'list': functools.partial(aslist, sep=',') |
|
167 | 166 | } |
@@ -179,7 +178,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
179 | 178 | |
|
180 | 179 | @validates('_app_settings_value') |
|
181 | 180 | def validate_settings_value(self, key, val): |
|
182 |
assert type(val) == |
|
|
181 | assert type(val) == str | |
|
183 | 182 | return val |
|
184 | 183 | |
|
185 | 184 | @hybrid_property |
@@ -196,7 +195,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
196 | 195 | |
|
197 | 196 | :param val: |
|
198 | 197 | """ |
|
199 |
self._app_settings_value = safe_ |
|
|
198 | self._app_settings_value = safe_str(val) | |
|
200 | 199 | |
|
201 | 200 | @hybrid_property |
|
202 | 201 | def app_settings_type(self): |
@@ -664,7 +663,7 b' class Repository(Base, BaseModel):' | |||
|
664 | 663 | |
|
665 | 664 | def __unicode__(self): |
|
666 | 665 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
667 |
safe_ |
|
|
666 | safe_str(self.repo_name)) | |
|
668 | 667 | |
|
669 | 668 | @classmethod |
|
670 | 669 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -46,7 +45,7 b' from zope.cachedescriptors.property impo' | |||
|
46 | 45 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
47 | 46 | |
|
48 | 47 | from rhodecode.lib.utils2 import ( |
|
49 |
str2bool, safe_str, get_commit_safe, |
|
|
48 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
50 | 49 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
51 | 50 | from rhodecode.lib.ext_json import json |
|
52 | 51 | from rhodecode.lib.caching_query import FromCache |
@@ -164,7 +163,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
164 | 163 | SETTINGS_TYPES = { |
|
165 | 164 | 'str': safe_str, |
|
166 | 165 | 'int': safe_int, |
|
167 |
'unicode': safe_ |
|
|
166 | 'unicode': safe_str, | |
|
168 | 167 | 'bool': str2bool, |
|
169 | 168 | 'list': functools.partial(aslist, sep=',') |
|
170 | 169 | } |
@@ -183,7 +182,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
183 | 182 | |
|
184 | 183 | @validates('_app_settings_value') |
|
185 | 184 | def validate_settings_value(self, key, val): |
|
186 |
assert type(val) == |
|
|
185 | assert type(val) == str | |
|
187 | 186 | return val |
|
188 | 187 | |
|
189 | 188 | @hybrid_property |
@@ -200,7 +199,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
200 | 199 | |
|
201 | 200 | :param val: |
|
202 | 201 | """ |
|
203 |
self._app_settings_value = safe_ |
|
|
202 | self._app_settings_value = safe_str(val) | |
|
204 | 203 | |
|
205 | 204 | @hybrid_property |
|
206 | 205 | def app_settings_type(self): |
@@ -692,7 +691,7 b' class Repository(Base, BaseModel):' | |||
|
692 | 691 | |
|
693 | 692 | def __unicode__(self): |
|
694 | 693 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
695 |
safe_ |
|
|
694 | safe_str(self.repo_name)) | |
|
696 | 695 | |
|
697 | 696 | @classmethod |
|
698 | 697 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -48,7 +47,7 b' from zope.cachedescriptors.property impo' | |||
|
48 | 47 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
49 | 48 | |
|
50 | 49 | from rhodecode.lib.utils2 import ( |
|
51 |
str2bool, safe_str, get_commit_safe, |
|
|
50 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
52 | 51 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
53 | 52 | from rhodecode.lib.ext_json import json |
|
54 | 53 | from rhodecode.lib.caching_query import FromCache |
@@ -166,7 +165,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
166 | 165 | SETTINGS_TYPES = { |
|
167 | 166 | 'str': safe_str, |
|
168 | 167 | 'int': safe_int, |
|
169 |
'unicode': safe_ |
|
|
168 | 'unicode': safe_str, | |
|
170 | 169 | 'bool': str2bool, |
|
171 | 170 | 'list': functools.partial(aslist, sep=',') |
|
172 | 171 | } |
@@ -185,7 +184,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
185 | 184 | |
|
186 | 185 | @validates('_app_settings_value') |
|
187 | 186 | def validate_settings_value(self, key, val): |
|
188 |
assert type(val) == |
|
|
187 | assert type(val) == str | |
|
189 | 188 | return val |
|
190 | 189 | |
|
191 | 190 | @hybrid_property |
@@ -202,7 +201,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
202 | 201 | |
|
203 | 202 | :param val: |
|
204 | 203 | """ |
|
205 |
self._app_settings_value = safe_ |
|
|
204 | self._app_settings_value = safe_str(val) | |
|
206 | 205 | |
|
207 | 206 | @hybrid_property |
|
208 | 207 | def app_settings_type(self): |
@@ -702,7 +701,7 b' class Repository(Base, BaseModel):' | |||
|
702 | 701 | |
|
703 | 702 | def __unicode__(self): |
|
704 | 703 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
705 |
safe_ |
|
|
704 | safe_str(self.repo_name)) | |
|
706 | 705 | |
|
707 | 706 | @classmethod |
|
708 | 707 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -48,7 +47,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
48 | 47 | from rhodecode.lib.vcs.backends.base import ( |
|
49 | 48 | EmptyCommit, Reference, MergeFailureReason) |
|
50 | 49 | from rhodecode.lib.utils2 import ( |
|
51 |
str2bool, safe_str, get_commit_safe, |
|
|
50 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
52 | 51 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
53 | 52 | from rhodecode.lib.ext_json import json |
|
54 | 53 | from rhodecode.lib.caching_query import FromCache |
@@ -210,7 +209,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
210 | 209 | SETTINGS_TYPES = { |
|
211 | 210 | 'str': safe_str, |
|
212 | 211 | 'int': safe_int, |
|
213 |
'unicode': safe_ |
|
|
212 | 'unicode': safe_str, | |
|
214 | 213 | 'bool': str2bool, |
|
215 | 214 | 'list': functools.partial(aslist, sep=',') |
|
216 | 215 | } |
@@ -229,7 +228,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
229 | 228 | |
|
230 | 229 | @validates('_app_settings_value') |
|
231 | 230 | def validate_settings_value(self, key, val): |
|
232 |
assert type(val) == |
|
|
231 | assert type(val) == str | |
|
233 | 232 | return val |
|
234 | 233 | |
|
235 | 234 | @hybrid_property |
@@ -246,7 +245,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
246 | 245 | |
|
247 | 246 | :param val: |
|
248 | 247 | """ |
|
249 |
self._app_settings_value = safe_ |
|
|
248 | self._app_settings_value = safe_str(val) | |
|
250 | 249 | |
|
251 | 250 | @hybrid_property |
|
252 | 251 | def app_settings_type(self): |
@@ -743,7 +742,7 b' class Repository(Base, BaseModel):' | |||
|
743 | 742 | |
|
744 | 743 | def __unicode__(self): |
|
745 | 744 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
746 |
safe_ |
|
|
745 | safe_str(self.repo_name)) | |
|
747 | 746 | |
|
748 | 747 | @classmethod |
|
749 | 748 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -48,7 +47,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
48 | 47 | from rhodecode.lib.vcs.backends.base import ( |
|
49 | 48 | EmptyCommit, Reference, MergeFailureReason) |
|
50 | 49 | from rhodecode.lib.utils2 import ( |
|
51 |
str2bool, safe_str, get_commit_safe, |
|
|
50 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
52 | 51 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
53 | 52 | from rhodecode.lib.ext_json import json |
|
54 | 53 | from rhodecode.lib.caching_query import FromCache |
@@ -210,7 +209,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
210 | 209 | SETTINGS_TYPES = { |
|
211 | 210 | 'str': safe_str, |
|
212 | 211 | 'int': safe_int, |
|
213 |
'unicode': safe_ |
|
|
212 | 'unicode': safe_str, | |
|
214 | 213 | 'bool': str2bool, |
|
215 | 214 | 'list': functools.partial(aslist, sep=',') |
|
216 | 215 | } |
@@ -229,7 +228,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
229 | 228 | |
|
230 | 229 | @validates('_app_settings_value') |
|
231 | 230 | def validate_settings_value(self, key, val): |
|
232 |
assert type(val) == |
|
|
231 | assert type(val) == str | |
|
233 | 232 | return val |
|
234 | 233 | |
|
235 | 234 | @hybrid_property |
@@ -246,7 +245,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
246 | 245 | |
|
247 | 246 | :param val: |
|
248 | 247 | """ |
|
249 |
self._app_settings_value = safe_ |
|
|
248 | self._app_settings_value = safe_str(val) | |
|
250 | 249 | |
|
251 | 250 | @hybrid_property |
|
252 | 251 | def app_settings_type(self): |
@@ -743,7 +742,7 b' class Repository(Base, BaseModel):' | |||
|
743 | 742 | |
|
744 | 743 | def __unicode__(self): |
|
745 | 744 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
746 |
safe_ |
|
|
745 | safe_str(self.repo_name)) | |
|
747 | 746 | |
|
748 | 747 | @classmethod |
|
749 | 748 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -49,7 +48,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
49 | 48 | from rhodecode.lib.vcs.backends.base import ( |
|
50 | 49 | EmptyCommit, Reference, MergeFailureReason) |
|
51 | 50 | from rhodecode.lib.utils2 import ( |
|
52 |
str2bool, safe_str, get_commit_safe, |
|
|
51 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
53 | 52 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
54 | 53 | from rhodecode.lib.ext_json import json |
|
55 | 54 | from rhodecode.lib.caching_query import FromCache |
@@ -211,7 +210,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
211 | 210 | SETTINGS_TYPES = { |
|
212 | 211 | 'str': safe_str, |
|
213 | 212 | 'int': safe_int, |
|
214 |
'unicode': safe_ |
|
|
213 | 'unicode': safe_str, | |
|
215 | 214 | 'bool': str2bool, |
|
216 | 215 | 'list': functools.partial(aslist, sep=',') |
|
217 | 216 | } |
@@ -230,7 +229,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
230 | 229 | |
|
231 | 230 | @validates('_app_settings_value') |
|
232 | 231 | def validate_settings_value(self, key, val): |
|
233 |
assert type(val) == |
|
|
232 | assert type(val) == str | |
|
234 | 233 | return val |
|
235 | 234 | |
|
236 | 235 | @hybrid_property |
@@ -247,7 +246,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
247 | 246 | |
|
248 | 247 | :param val: |
|
249 | 248 | """ |
|
250 |
self._app_settings_value = safe_ |
|
|
249 | self._app_settings_value = safe_str(val) | |
|
251 | 250 | |
|
252 | 251 | @hybrid_property |
|
253 | 252 | def app_settings_type(self): |
@@ -744,7 +743,7 b' class Repository(Base, BaseModel):' | |||
|
744 | 743 | |
|
745 | 744 | def __unicode__(self): |
|
746 | 745 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
747 |
safe_ |
|
|
746 | safe_str(self.repo_name)) | |
|
748 | 747 | |
|
749 | 748 | @classmethod |
|
750 | 749 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -49,7 +48,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
49 | 48 | from rhodecode.lib.vcs.backends.base import ( |
|
50 | 49 | EmptyCommit, Reference, MergeFailureReason) |
|
51 | 50 | from rhodecode.lib.utils2 import ( |
|
52 |
str2bool, safe_str, get_commit_safe, |
|
|
51 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
53 | 52 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
54 | 53 | from rhodecode.lib.ext_json import json |
|
55 | 54 | from rhodecode.lib.caching_query import FromCache |
@@ -211,7 +210,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
211 | 210 | SETTINGS_TYPES = { |
|
212 | 211 | 'str': safe_str, |
|
213 | 212 | 'int': safe_int, |
|
214 |
'unicode': safe_ |
|
|
213 | 'unicode': safe_str, | |
|
215 | 214 | 'bool': str2bool, |
|
216 | 215 | 'list': functools.partial(aslist, sep=',') |
|
217 | 216 | } |
@@ -230,7 +229,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
230 | 229 | |
|
231 | 230 | @validates('_app_settings_value') |
|
232 | 231 | def validate_settings_value(self, key, val): |
|
233 |
assert type(val) == |
|
|
232 | assert type(val) == str | |
|
234 | 233 | return val |
|
235 | 234 | |
|
236 | 235 | @hybrid_property |
@@ -247,7 +246,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
247 | 246 | |
|
248 | 247 | :param val: |
|
249 | 248 | """ |
|
250 |
self._app_settings_value = safe_ |
|
|
249 | self._app_settings_value = safe_str(val) | |
|
251 | 250 | |
|
252 | 251 | @hybrid_property |
|
253 | 252 | def app_settings_type(self): |
@@ -744,7 +743,7 b' class Repository(Base, BaseModel):' | |||
|
744 | 743 | |
|
745 | 744 | def __unicode__(self): |
|
746 | 745 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
747 |
safe_ |
|
|
746 | safe_str(self.repo_name)) | |
|
748 | 747 | |
|
749 | 748 | @classmethod |
|
750 | 749 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -50,7 +49,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
50 | 49 | from rhodecode.lib.vcs.backends.base import ( |
|
51 | 50 | EmptyCommit, Reference, MergeFailureReason) |
|
52 | 51 | from rhodecode.lib.utils2 import ( |
|
53 |
str2bool, safe_str, get_commit_safe, |
|
|
52 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
54 | 53 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
55 | 54 | from rhodecode.lib.ext_json import json |
|
56 | 55 | from rhodecode.lib.caching_query import FromCache |
@@ -212,7 +211,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
212 | 211 | SETTINGS_TYPES = { |
|
213 | 212 | 'str': safe_str, |
|
214 | 213 | 'int': safe_int, |
|
215 |
'unicode': safe_ |
|
|
214 | 'unicode': safe_str, | |
|
216 | 215 | 'bool': str2bool, |
|
217 | 216 | 'list': functools.partial(aslist, sep=',') |
|
218 | 217 | } |
@@ -231,7 +230,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
231 | 230 | |
|
232 | 231 | @validates('_app_settings_value') |
|
233 | 232 | def validate_settings_value(self, key, val): |
|
234 |
assert type(val) == |
|
|
233 | assert type(val) == str | |
|
235 | 234 | return val |
|
236 | 235 | |
|
237 | 236 | @hybrid_property |
@@ -248,7 +247,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
248 | 247 | |
|
249 | 248 | :param val: |
|
250 | 249 | """ |
|
251 |
self._app_settings_value = safe_ |
|
|
250 | self._app_settings_value = safe_str(val) | |
|
252 | 251 | |
|
253 | 252 | @hybrid_property |
|
254 | 253 | def app_settings_type(self): |
@@ -750,7 +749,7 b' class Repository(Base, BaseModel):' | |||
|
750 | 749 | |
|
751 | 750 | def __unicode__(self): |
|
752 | 751 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
753 |
safe_ |
|
|
752 | safe_str(self.repo_name)) | |
|
754 | 753 | |
|
755 | 754 | @classmethod |
|
756 | 755 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -50,7 +49,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
50 | 49 | from rhodecode.lib.vcs.backends.base import ( |
|
51 | 50 | EmptyCommit, Reference, MergeFailureReason) |
|
52 | 51 | from rhodecode.lib.utils2 import ( |
|
53 |
str2bool, safe_str, get_commit_safe, |
|
|
52 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
54 | 53 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
55 | 54 | from rhodecode.lib.ext_json import json |
|
56 | 55 | from rhodecode.lib.caching_query import FromCache |
@@ -212,7 +211,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
212 | 211 | SETTINGS_TYPES = { |
|
213 | 212 | 'str': safe_str, |
|
214 | 213 | 'int': safe_int, |
|
215 |
'unicode': safe_ |
|
|
214 | 'unicode': safe_str, | |
|
216 | 215 | 'bool': str2bool, |
|
217 | 216 | 'list': functools.partial(aslist, sep=',') |
|
218 | 217 | } |
@@ -231,7 +230,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
231 | 230 | |
|
232 | 231 | @validates('_app_settings_value') |
|
233 | 232 | def validate_settings_value(self, key, val): |
|
234 |
assert type(val) == |
|
|
233 | assert type(val) == str | |
|
235 | 234 | return val |
|
236 | 235 | |
|
237 | 236 | @hybrid_property |
@@ -248,7 +247,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
248 | 247 | |
|
249 | 248 | :param val: |
|
250 | 249 | """ |
|
251 |
self._app_settings_value = safe_ |
|
|
250 | self._app_settings_value = safe_str(val) | |
|
252 | 251 | |
|
253 | 252 | @hybrid_property |
|
254 | 253 | def app_settings_type(self): |
@@ -315,7 +314,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
315 | 314 | SETTINGS_TYPES = { |
|
316 | 315 | 'str': safe_str, |
|
317 | 316 | 'int': safe_int, |
|
318 |
'unicode': safe_ |
|
|
317 | 'unicode': safe_str, | |
|
319 | 318 | 'bool': str2bool, |
|
320 | 319 | 'list': functools.partial(aslist, sep=',') |
|
321 | 320 | } |
@@ -346,7 +345,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
346 | 345 | |
|
347 | 346 | @validates('_app_settings_value') |
|
348 | 347 | def validate_settings_value(self, key, val): |
|
349 |
assert type(val) == |
|
|
348 | assert type(val) == str | |
|
350 | 349 | return val |
|
351 | 350 | |
|
352 | 351 | @hybrid_property |
@@ -364,7 +363,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
364 | 363 | |
|
365 | 364 | :param val: |
|
366 | 365 | """ |
|
367 |
self._app_settings_value = safe_ |
|
|
366 | self._app_settings_value = safe_str(val) | |
|
368 | 367 | |
|
369 | 368 | @hybrid_property |
|
370 | 369 | def app_settings_type(self): |
@@ -872,7 +871,7 b' class Repository(Base, BaseModel):' | |||
|
872 | 871 | |
|
873 | 872 | def __unicode__(self): |
|
874 | 873 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
875 |
safe_ |
|
|
874 | safe_str(self.repo_name)) | |
|
876 | 875 | |
|
877 | 876 | @classmethod |
|
878 | 877 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -50,7 +49,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
50 | 49 | from rhodecode.lib.vcs.backends.base import ( |
|
51 | 50 | EmptyCommit, Reference, MergeFailureReason) |
|
52 | 51 | from rhodecode.lib.utils2 import ( |
|
53 |
str2bool, safe_str, get_commit_safe, |
|
|
52 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
54 | 53 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
55 | 54 | from rhodecode.lib.ext_json import json |
|
56 | 55 | from rhodecode.lib.caching_query import FromCache |
@@ -234,7 +233,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
234 | 233 | SETTINGS_TYPES = { |
|
235 | 234 | 'str': safe_str, |
|
236 | 235 | 'int': safe_int, |
|
237 |
'unicode': safe_ |
|
|
236 | 'unicode': safe_str, | |
|
238 | 237 | 'bool': str2bool, |
|
239 | 238 | 'list': functools.partial(aslist, sep=',') |
|
240 | 239 | } |
@@ -253,7 +252,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
253 | 252 | |
|
254 | 253 | @validates('_app_settings_value') |
|
255 | 254 | def validate_settings_value(self, key, val): |
|
256 |
assert type(val) == |
|
|
255 | assert type(val) == str | |
|
257 | 256 | return val |
|
258 | 257 | |
|
259 | 258 | @hybrid_property |
@@ -270,7 +269,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
270 | 269 | |
|
271 | 270 | :param val: |
|
272 | 271 | """ |
|
273 |
self._app_settings_value = safe_ |
|
|
272 | self._app_settings_value = safe_str(val) | |
|
274 | 273 | |
|
275 | 274 | @hybrid_property |
|
276 | 275 | def app_settings_type(self): |
@@ -337,7 +336,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
337 | 336 | SETTINGS_TYPES = { |
|
338 | 337 | 'str': safe_str, |
|
339 | 338 | 'int': safe_int, |
|
340 |
'unicode': safe_ |
|
|
339 | 'unicode': safe_str, | |
|
341 | 340 | 'bool': str2bool, |
|
342 | 341 | 'list': functools.partial(aslist, sep=',') |
|
343 | 342 | } |
@@ -368,7 +367,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
368 | 367 | |
|
369 | 368 | @validates('_app_settings_value') |
|
370 | 369 | def validate_settings_value(self, key, val): |
|
371 |
assert type(val) == |
|
|
370 | assert type(val) == str | |
|
372 | 371 | return val |
|
373 | 372 | |
|
374 | 373 | @hybrid_property |
@@ -386,7 +385,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
386 | 385 | |
|
387 | 386 | :param val: |
|
388 | 387 | """ |
|
389 |
self._app_settings_value = safe_ |
|
|
388 | self._app_settings_value = safe_str(val) | |
|
390 | 389 | |
|
391 | 390 | @hybrid_property |
|
392 | 391 | def app_settings_type(self): |
@@ -897,7 +896,7 b' class Repository(Base, BaseModel):' | |||
|
897 | 896 | |
|
898 | 897 | def __unicode__(self): |
|
899 | 898 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
900 |
safe_ |
|
|
899 | safe_str(self.repo_name)) | |
|
901 | 900 | |
|
902 | 901 | @classmethod |
|
903 | 902 | def get_by_repo_name(cls, repo_name): |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -55,7 +54,7 b' from rhodecode.translation import _' | |||
|
55 | 54 | from rhodecode.lib.vcs import get_vcs_instance |
|
56 | 55 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
57 | 56 | from rhodecode.lib.utils2 import ( |
|
58 |
str2bool, safe_str, get_commit_safe, |
|
|
57 | str2bool, safe_str, get_commit_safe, md5_safe, | |
|
59 | 58 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
60 | 59 | glob2re, StrictAttributeDict, cleaned_uri) |
|
61 | 60 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -308,7 +307,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
308 | 307 | SETTINGS_TYPES = { |
|
309 | 308 | 'str': safe_str, |
|
310 | 309 | 'int': safe_int, |
|
311 |
'unicode': safe_ |
|
|
310 | 'unicode': safe_str, | |
|
312 | 311 | 'bool': str2bool, |
|
313 | 312 | 'list': functools.partial(aslist, sep=',') |
|
314 | 313 | } |
@@ -327,7 +326,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
327 | 326 | |
|
328 | 327 | @validates('_app_settings_value') |
|
329 | 328 | def validate_settings_value(self, key, val): |
|
330 |
assert type(val) == |
|
|
329 | assert type(val) == str | |
|
331 | 330 | return val |
|
332 | 331 | |
|
333 | 332 | @hybrid_property |
@@ -339,7 +338,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
339 | 338 | # decode the encrypted value |
|
340 | 339 | if 'encrypted' in self.app_settings_type: |
|
341 | 340 | cipher = EncryptedTextValue() |
|
342 |
v = safe_ |
|
|
341 | v = safe_str(cipher.process_result_value(v, None)) | |
|
343 | 342 | |
|
344 | 343 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
345 | 344 | self.SETTINGS_TYPES['unicode'] |
@@ -352,11 +351,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
352 | 351 | |
|
353 | 352 | :param val: |
|
354 | 353 | """ |
|
355 |
val = safe_ |
|
|
354 | val = safe_str(val) | |
|
356 | 355 | # encode the encrypted value |
|
357 | 356 | if 'encrypted' in self.app_settings_type: |
|
358 | 357 | cipher = EncryptedTextValue() |
|
359 |
val = safe_ |
|
|
358 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
360 | 359 | self._app_settings_value = val |
|
361 | 360 | |
|
362 | 361 | @hybrid_property |
@@ -455,7 +454,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
455 | 454 | |
|
456 | 455 | @validates('_app_settings_value') |
|
457 | 456 | def validate_settings_value(self, key, val): |
|
458 |
assert type(val) == |
|
|
457 | assert type(val) == str | |
|
459 | 458 | return val |
|
460 | 459 | |
|
461 | 460 | @hybrid_property |
@@ -473,7 +472,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
473 | 472 | |
|
474 | 473 | :param val: |
|
475 | 474 | """ |
|
476 |
self._app_settings_value = safe_ |
|
|
475 | self._app_settings_value = safe_str(val) | |
|
477 | 476 | |
|
478 | 477 | @hybrid_property |
|
479 | 478 | def app_settings_type(self): |
@@ -1182,7 +1181,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1182 | 1181 | |
|
1183 | 1182 | @classmethod |
|
1184 | 1183 | def _get_ip_range(cls, ip_addr): |
|
1185 |
net = ipaddress.ip_network(safe_ |
|
|
1184 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1186 | 1185 | return [str(net.network_address), str(net.broadcast_address)] |
|
1187 | 1186 | |
|
1188 | 1187 | def __json__(self): |
@@ -1621,7 +1620,7 b' class Repository(Base, BaseModel):' | |||
|
1621 | 1620 | |
|
1622 | 1621 | def __unicode__(self): |
|
1623 | 1622 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1624 |
safe_ |
|
|
1623 | safe_str(self.repo_name)) | |
|
1625 | 1624 | |
|
1626 | 1625 | @hybrid_property |
|
1627 | 1626 | def description_safe(self): |
@@ -1827,7 +1826,7 b' class Repository(Base, BaseModel):' | |||
|
1827 | 1826 | # names in the database, but that eventually needs to be converted |
|
1828 | 1827 | # into a valid system path |
|
1829 | 1828 | p += self.repo_name.split(self.NAME_SEP) |
|
1830 |
return os.path.join(*map(safe_ |
|
|
1829 | return os.path.join(*map(safe_str, p)) | |
|
1831 | 1830 | |
|
1832 | 1831 | @property |
|
1833 | 1832 | def cache_keys(self): |
@@ -3113,9 +3112,9 b' class CacheKey(Base, BaseModel):' | |||
|
3113 | 3112 | instance_id from .ini file. |
|
3114 | 3113 | """ |
|
3115 | 3114 | import rhodecode |
|
3116 |
prefix = safe_ |
|
|
3117 | ||
|
3118 |
repo_as_unicode = safe_ |
|
|
3115 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
3116 | ||
|
3117 | repo_as_unicode = safe_str(repo_name) | |
|
3119 | 3118 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
3120 | 3119 | if cache_type else repo_as_unicode |
|
3121 | 3120 | |
@@ -3491,7 +3490,7 b' class _PullRequestBase(BaseModel):' | |||
|
3491 | 3490 | merge_status = PullRequestModel().merge_status(pull_request) |
|
3492 | 3491 | merge_state = { |
|
3493 | 3492 | 'status': merge_status[0], |
|
3494 |
'message': safe_ |
|
|
3493 | 'message': safe_str(merge_status[1]), | |
|
3495 | 3494 | } |
|
3496 | 3495 | else: |
|
3497 | 3496 | merge_state = {'status': 'not_available', |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -55,7 +54,7 b' from rhodecode.translation import _' | |||
|
55 | 54 | from rhodecode.lib.vcs import get_vcs_instance |
|
56 | 55 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
57 | 56 | from rhodecode.lib.utils2 import ( |
|
58 |
str2bool, safe_str, get_commit_safe, |
|
|
57 | str2bool, safe_str, get_commit_safe, md5_safe, | |
|
59 | 58 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
60 | 59 | glob2re, StrictAttributeDict, cleaned_uri) |
|
61 | 60 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -308,7 +307,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
308 | 307 | SETTINGS_TYPES = { |
|
309 | 308 | 'str': safe_str, |
|
310 | 309 | 'int': safe_int, |
|
311 |
'unicode': safe_ |
|
|
310 | 'unicode': safe_str, | |
|
312 | 311 | 'bool': str2bool, |
|
313 | 312 | 'list': functools.partial(aslist, sep=',') |
|
314 | 313 | } |
@@ -327,7 +326,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
327 | 326 | |
|
328 | 327 | @validates('_app_settings_value') |
|
329 | 328 | def validate_settings_value(self, key, val): |
|
330 |
assert type(val) == |
|
|
329 | assert type(val) == str | |
|
331 | 330 | return val |
|
332 | 331 | |
|
333 | 332 | @hybrid_property |
@@ -339,7 +338,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
339 | 338 | # decode the encrypted value |
|
340 | 339 | if 'encrypted' in self.app_settings_type: |
|
341 | 340 | cipher = EncryptedTextValue() |
|
342 |
v = safe_ |
|
|
341 | v = safe_str(cipher.process_result_value(v, None)) | |
|
343 | 342 | |
|
344 | 343 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
345 | 344 | self.SETTINGS_TYPES['unicode'] |
@@ -352,11 +351,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
352 | 351 | |
|
353 | 352 | :param val: |
|
354 | 353 | """ |
|
355 |
val = safe_ |
|
|
354 | val = safe_str(val) | |
|
356 | 355 | # encode the encrypted value |
|
357 | 356 | if 'encrypted' in self.app_settings_type: |
|
358 | 357 | cipher = EncryptedTextValue() |
|
359 |
val = safe_ |
|
|
358 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
360 | 359 | self._app_settings_value = val |
|
361 | 360 | |
|
362 | 361 | @hybrid_property |
@@ -455,7 +454,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
455 | 454 | |
|
456 | 455 | @validates('_app_settings_value') |
|
457 | 456 | def validate_settings_value(self, key, val): |
|
458 |
assert type(val) == |
|
|
457 | assert type(val) == str | |
|
459 | 458 | return val |
|
460 | 459 | |
|
461 | 460 | @hybrid_property |
@@ -473,7 +472,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
473 | 472 | |
|
474 | 473 | :param val: |
|
475 | 474 | """ |
|
476 |
self._app_settings_value = safe_ |
|
|
475 | self._app_settings_value = safe_str(val) | |
|
477 | 476 | |
|
478 | 477 | @hybrid_property |
|
479 | 478 | def app_settings_type(self): |
@@ -1186,7 +1185,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1186 | 1185 | |
|
1187 | 1186 | @classmethod |
|
1188 | 1187 | def _get_ip_range(cls, ip_addr): |
|
1189 |
net = ipaddress.ip_network(safe_ |
|
|
1188 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1190 | 1189 | return [str(net.network_address), str(net.broadcast_address)] |
|
1191 | 1190 | |
|
1192 | 1191 | def __json__(self): |
@@ -1641,7 +1640,7 b' class Repository(Base, BaseModel):' | |||
|
1641 | 1640 | |
|
1642 | 1641 | def __unicode__(self): |
|
1643 | 1642 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1644 |
safe_ |
|
|
1643 | safe_str(self.repo_name)) | |
|
1645 | 1644 | |
|
1646 | 1645 | @hybrid_property |
|
1647 | 1646 | def description_safe(self): |
@@ -1846,7 +1845,7 b' class Repository(Base, BaseModel):' | |||
|
1846 | 1845 | # names in the database, but that eventually needs to be converted |
|
1847 | 1846 | # into a valid system path |
|
1848 | 1847 | p += self.repo_name.split(self.NAME_SEP) |
|
1849 |
return os.path.join(*map(safe_ |
|
|
1848 | return os.path.join(*map(safe_str, p)) | |
|
1850 | 1849 | |
|
1851 | 1850 | @property |
|
1852 | 1851 | def cache_keys(self): |
@@ -3196,9 +3195,9 b' class CacheKey(Base, BaseModel):' | |||
|
3196 | 3195 | instance_id from .ini file. |
|
3197 | 3196 | """ |
|
3198 | 3197 | import rhodecode |
|
3199 |
prefix = safe_ |
|
|
3200 | ||
|
3201 |
repo_as_unicode = safe_ |
|
|
3198 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
3199 | ||
|
3200 | repo_as_unicode = safe_str(repo_name) | |
|
3202 | 3201 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
3203 | 3202 | if cache_type else repo_as_unicode |
|
3204 | 3203 | |
@@ -3574,7 +3573,7 b' class _PullRequestBase(BaseModel):' | |||
|
3574 | 3573 | merge_status = PullRequestModel().merge_status(pull_request) |
|
3575 | 3574 | merge_state = { |
|
3576 | 3575 | 'status': merge_status[0], |
|
3577 |
'message': safe_ |
|
|
3576 | 'message': safe_str(merge_status[1]), | |
|
3578 | 3577 | } |
|
3579 | 3578 | else: |
|
3580 | 3579 | merge_state = {'status': 'not_available', |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -54,7 +53,7 b' from rhodecode.translation import _' | |||
|
54 | 53 | from rhodecode.lib.vcs import get_vcs_instance |
|
55 | 54 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
56 | 55 | from rhodecode.lib.utils2 import ( |
|
57 |
str2bool, safe_str, get_commit_safe, |
|
|
56 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
58 | 57 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
59 | 58 | glob2re, StrictAttributeDict, cleaned_uri) |
|
60 | 59 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -314,7 +313,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
314 | 313 | SETTINGS_TYPES = { |
|
315 | 314 | 'str': safe_str, |
|
316 | 315 | 'int': safe_int, |
|
317 |
'unicode': safe_ |
|
|
316 | 'unicode': safe_str, | |
|
318 | 317 | 'bool': str2bool, |
|
319 | 318 | 'list': functools.partial(aslist, sep=',') |
|
320 | 319 | } |
@@ -333,7 +332,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
333 | 332 | |
|
334 | 333 | @validates('_app_settings_value') |
|
335 | 334 | def validate_settings_value(self, key, val): |
|
336 |
assert type(val) == |
|
|
335 | assert type(val) == str | |
|
337 | 336 | return val |
|
338 | 337 | |
|
339 | 338 | @hybrid_property |
@@ -345,7 +344,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
345 | 344 | # decode the encrypted value |
|
346 | 345 | if 'encrypted' in self.app_settings_type: |
|
347 | 346 | cipher = EncryptedTextValue() |
|
348 |
v = safe_ |
|
|
347 | v = safe_str(cipher.process_result_value(v, None)) | |
|
349 | 348 | |
|
350 | 349 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
351 | 350 | self.SETTINGS_TYPES['unicode'] |
@@ -358,11 +357,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
358 | 357 | |
|
359 | 358 | :param val: |
|
360 | 359 | """ |
|
361 |
val = safe_ |
|
|
360 | val = safe_str(val) | |
|
362 | 361 | # encode the encrypted value |
|
363 | 362 | if 'encrypted' in self.app_settings_type: |
|
364 | 363 | cipher = EncryptedTextValue() |
|
365 |
val = safe_ |
|
|
364 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
366 | 365 | self._app_settings_value = val |
|
367 | 366 | |
|
368 | 367 | @hybrid_property |
@@ -465,7 +464,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
465 | 464 | |
|
466 | 465 | @validates('_app_settings_value') |
|
467 | 466 | def validate_settings_value(self, key, val): |
|
468 |
assert type(val) == |
|
|
467 | assert type(val) == str | |
|
469 | 468 | return val |
|
470 | 469 | |
|
471 | 470 | @hybrid_property |
@@ -483,7 +482,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
483 | 482 | |
|
484 | 483 | :param val: |
|
485 | 484 | """ |
|
486 |
self._app_settings_value = safe_ |
|
|
485 | self._app_settings_value = safe_str(val) | |
|
487 | 486 | |
|
488 | 487 | @hybrid_property |
|
489 | 488 | def app_settings_type(self): |
@@ -1195,7 +1194,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1195 | 1194 | |
|
1196 | 1195 | @classmethod |
|
1197 | 1196 | def _get_ip_range(cls, ip_addr): |
|
1198 |
net = ipaddress.ip_network(safe_ |
|
|
1197 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1199 | 1198 | return [str(net.network_address), str(net.broadcast_address)] |
|
1200 | 1199 | |
|
1201 | 1200 | def __json__(self): |
@@ -1657,7 +1656,7 b' class Repository(Base, BaseModel):' | |||
|
1657 | 1656 | |
|
1658 | 1657 | def __unicode__(self): |
|
1659 | 1658 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1660 |
safe_ |
|
|
1659 | safe_str(self.repo_name)) | |
|
1661 | 1660 | |
|
1662 | 1661 | @hybrid_property |
|
1663 | 1662 | def description_safe(self): |
@@ -1866,7 +1865,7 b' class Repository(Base, BaseModel):' | |||
|
1866 | 1865 | # names in the database, but that eventually needs to be converted |
|
1867 | 1866 | # into a valid system path |
|
1868 | 1867 | p += self.repo_name.split(self.NAME_SEP) |
|
1869 |
return os.path.join(*map(safe_ |
|
|
1868 | return os.path.join(*map(safe_str, p)) | |
|
1870 | 1869 | |
|
1871 | 1870 | @property |
|
1872 | 1871 | def cache_keys(self): |
@@ -2377,7 +2376,7 b' class Repository(Base, BaseModel):' | |||
|
2377 | 2376 | def _get_instance_cached(self): |
|
2378 | 2377 | from rhodecode.lib import rc_cache |
|
2379 | 2378 | |
|
2380 |
cache_namespace_uid = ' |
|
|
2379 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2381 | 2380 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2382 | 2381 | repo_id=self.repo_id) |
|
2383 | 2382 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -3598,7 +3597,7 b' class _PullRequestBase(BaseModel):' | |||
|
3598 | 3597 | if len(parts) != 3: |
|
3599 | 3598 | raise ValueError( |
|
3600 | 3599 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3601 |
self._source_ref = safe_ |
|
|
3600 | self._source_ref = safe_str(val) | |
|
3602 | 3601 | |
|
3603 | 3602 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
3604 | 3603 | |
@@ -3612,7 +3611,7 b' class _PullRequestBase(BaseModel):' | |||
|
3612 | 3611 | if len(parts) != 3: |
|
3613 | 3612 | raise ValueError( |
|
3614 | 3613 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3615 |
self._target_ref = safe_ |
|
|
3614 | self._target_ref = safe_str(val) | |
|
3616 | 3615 | |
|
3617 | 3616 | @declared_attr |
|
3618 | 3617 | def target_repo_id(cls): |
@@ -3724,7 +3723,7 b' class _PullRequestBase(BaseModel):' | |||
|
3724 | 3723 | merge_status = PullRequestModel().merge_status(pull_request) |
|
3725 | 3724 | merge_state = { |
|
3726 | 3725 | 'status': merge_status[0], |
|
3727 |
'message': safe_ |
|
|
3726 | 'message': safe_str(merge_status[1]), | |
|
3728 | 3727 | } |
|
3729 | 3728 | else: |
|
3730 | 3729 | merge_state = {'status': 'not_available', |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -54,7 +53,7 b' from rhodecode.translation import _' | |||
|
54 | 53 | from rhodecode.lib.vcs import get_vcs_instance |
|
55 | 54 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
56 | 55 | from rhodecode.lib.utils2 import ( |
|
57 |
str2bool, safe_str, get_commit_safe, |
|
|
56 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
58 | 57 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
59 | 58 | glob2re, StrictAttributeDict, cleaned_uri) |
|
60 | 59 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -314,7 +313,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
314 | 313 | SETTINGS_TYPES = { |
|
315 | 314 | 'str': safe_str, |
|
316 | 315 | 'int': safe_int, |
|
317 |
'unicode': safe_ |
|
|
316 | 'unicode': safe_str, | |
|
318 | 317 | 'bool': str2bool, |
|
319 | 318 | 'list': functools.partial(aslist, sep=',') |
|
320 | 319 | } |
@@ -333,7 +332,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
333 | 332 | |
|
334 | 333 | @validates('_app_settings_value') |
|
335 | 334 | def validate_settings_value(self, key, val): |
|
336 |
assert type(val) == |
|
|
335 | assert type(val) == str | |
|
337 | 336 | return val |
|
338 | 337 | |
|
339 | 338 | @hybrid_property |
@@ -345,7 +344,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
345 | 344 | # decode the encrypted value |
|
346 | 345 | if 'encrypted' in self.app_settings_type: |
|
347 | 346 | cipher = EncryptedTextValue() |
|
348 |
v = safe_ |
|
|
347 | v = safe_str(cipher.process_result_value(v, None)) | |
|
349 | 348 | |
|
350 | 349 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
351 | 350 | self.SETTINGS_TYPES['unicode'] |
@@ -358,11 +357,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
358 | 357 | |
|
359 | 358 | :param val: |
|
360 | 359 | """ |
|
361 |
val = safe_ |
|
|
360 | val = safe_str(val) | |
|
362 | 361 | # encode the encrypted value |
|
363 | 362 | if 'encrypted' in self.app_settings_type: |
|
364 | 363 | cipher = EncryptedTextValue() |
|
365 |
val = safe_ |
|
|
364 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
366 | 365 | self._app_settings_value = val |
|
367 | 366 | |
|
368 | 367 | @hybrid_property |
@@ -465,7 +464,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
465 | 464 | |
|
466 | 465 | @validates('_app_settings_value') |
|
467 | 466 | def validate_settings_value(self, key, val): |
|
468 |
assert type(val) == |
|
|
467 | assert type(val) == str | |
|
469 | 468 | return val |
|
470 | 469 | |
|
471 | 470 | @hybrid_property |
@@ -483,7 +482,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
483 | 482 | |
|
484 | 483 | :param val: |
|
485 | 484 | """ |
|
486 |
self._app_settings_value = safe_ |
|
|
485 | self._app_settings_value = safe_str(val) | |
|
487 | 486 | |
|
488 | 487 | @hybrid_property |
|
489 | 488 | def app_settings_type(self): |
@@ -1197,7 +1196,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1197 | 1196 | |
|
1198 | 1197 | @classmethod |
|
1199 | 1198 | def _get_ip_range(cls, ip_addr): |
|
1200 |
net = ipaddress.ip_network(safe_ |
|
|
1199 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1201 | 1200 | return [str(net.network_address), str(net.broadcast_address)] |
|
1202 | 1201 | |
|
1203 | 1202 | def __json__(self): |
@@ -1670,7 +1669,7 b' class Repository(Base, BaseModel):' | |||
|
1670 | 1669 | |
|
1671 | 1670 | def __unicode__(self): |
|
1672 | 1671 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1673 |
safe_ |
|
|
1672 | safe_str(self.repo_name)) | |
|
1674 | 1673 | |
|
1675 | 1674 | @hybrid_property |
|
1676 | 1675 | def description_safe(self): |
@@ -1879,7 +1878,7 b' class Repository(Base, BaseModel):' | |||
|
1879 | 1878 | # names in the database, but that eventually needs to be converted |
|
1880 | 1879 | # into a valid system path |
|
1881 | 1880 | p += self.repo_name.split(self.NAME_SEP) |
|
1882 |
return os.path.join(*map(safe_ |
|
|
1881 | return os.path.join(*map(safe_str, p)) | |
|
1883 | 1882 | |
|
1884 | 1883 | @property |
|
1885 | 1884 | def cache_keys(self): |
@@ -2400,7 +2399,7 b' class Repository(Base, BaseModel):' | |||
|
2400 | 2399 | def _get_instance_cached(self): |
|
2401 | 2400 | from rhodecode.lib import rc_cache |
|
2402 | 2401 | |
|
2403 |
cache_namespace_uid = ' |
|
|
2402 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2404 | 2403 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2405 | 2404 | repo_id=self.repo_id) |
|
2406 | 2405 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -3657,7 +3656,7 b' class _PullRequestBase(BaseModel):' | |||
|
3657 | 3656 | if len(parts) != 3: |
|
3658 | 3657 | raise ValueError( |
|
3659 | 3658 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3660 |
self._source_ref = safe_ |
|
|
3659 | self._source_ref = safe_str(val) | |
|
3661 | 3660 | |
|
3662 | 3661 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
3663 | 3662 | |
@@ -3671,7 +3670,7 b' class _PullRequestBase(BaseModel):' | |||
|
3671 | 3670 | if len(parts) != 3: |
|
3672 | 3671 | raise ValueError( |
|
3673 | 3672 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3674 |
self._target_ref = safe_ |
|
|
3673 | self._target_ref = safe_str(val) | |
|
3675 | 3674 | |
|
3676 | 3675 | @declared_attr |
|
3677 | 3676 | def target_repo_id(cls): |
@@ -3783,7 +3782,7 b' class _PullRequestBase(BaseModel):' | |||
|
3783 | 3782 | merge_status = PullRequestModel().merge_status(pull_request) |
|
3784 | 3783 | merge_state = { |
|
3785 | 3784 | 'status': merge_status[0], |
|
3786 |
'message': safe_ |
|
|
3785 | 'message': safe_str(merge_status[1]), | |
|
3787 | 3786 | } |
|
3788 | 3787 | else: |
|
3789 | 3788 | merge_state = {'status': 'not_available', |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -54,7 +53,7 b' from rhodecode.translation import _' | |||
|
54 | 53 | from rhodecode.lib.vcs import get_vcs_instance |
|
55 | 54 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
56 | 55 | from rhodecode.lib.utils2 import ( |
|
57 |
str2bool, safe_str, get_commit_safe, |
|
|
56 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
58 | 57 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
59 | 58 | glob2re, StrictAttributeDict, cleaned_uri) |
|
60 | 59 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -314,7 +313,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
314 | 313 | SETTINGS_TYPES = { |
|
315 | 314 | 'str': safe_str, |
|
316 | 315 | 'int': safe_int, |
|
317 |
'unicode': safe_ |
|
|
316 | 'unicode': safe_str, | |
|
318 | 317 | 'bool': str2bool, |
|
319 | 318 | 'list': functools.partial(aslist, sep=',') |
|
320 | 319 | } |
@@ -333,7 +332,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
333 | 332 | |
|
334 | 333 | @validates('_app_settings_value') |
|
335 | 334 | def validate_settings_value(self, key, val): |
|
336 |
assert type(val) == |
|
|
335 | assert type(val) == str | |
|
337 | 336 | return val |
|
338 | 337 | |
|
339 | 338 | @hybrid_property |
@@ -345,7 +344,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
345 | 344 | # decode the encrypted value |
|
346 | 345 | if 'encrypted' in self.app_settings_type: |
|
347 | 346 | cipher = EncryptedTextValue() |
|
348 |
v = safe_ |
|
|
347 | v = safe_str(cipher.process_result_value(v, None)) | |
|
349 | 348 | |
|
350 | 349 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
351 | 350 | self.SETTINGS_TYPES['unicode'] |
@@ -358,11 +357,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
358 | 357 | |
|
359 | 358 | :param val: |
|
360 | 359 | """ |
|
361 |
val = safe_ |
|
|
360 | val = safe_str(val) | |
|
362 | 361 | # encode the encrypted value |
|
363 | 362 | if 'encrypted' in self.app_settings_type: |
|
364 | 363 | cipher = EncryptedTextValue() |
|
365 |
val = safe_ |
|
|
364 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
366 | 365 | self._app_settings_value = val |
|
367 | 366 | |
|
368 | 367 | @hybrid_property |
@@ -465,7 +464,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
465 | 464 | |
|
466 | 465 | @validates('_app_settings_value') |
|
467 | 466 | def validate_settings_value(self, key, val): |
|
468 |
assert type(val) == |
|
|
467 | assert type(val) == str | |
|
469 | 468 | return val |
|
470 | 469 | |
|
471 | 470 | @hybrid_property |
@@ -483,7 +482,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
483 | 482 | |
|
484 | 483 | :param val: |
|
485 | 484 | """ |
|
486 |
self._app_settings_value = safe_ |
|
|
485 | self._app_settings_value = safe_str(val) | |
|
487 | 486 | |
|
488 | 487 | @hybrid_property |
|
489 | 488 | def app_settings_type(self): |
@@ -1197,7 +1196,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1197 | 1196 | |
|
1198 | 1197 | @classmethod |
|
1199 | 1198 | def _get_ip_range(cls, ip_addr): |
|
1200 |
net = ipaddress.ip_network(safe_ |
|
|
1199 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1201 | 1200 | return [str(net.network_address), str(net.broadcast_address)] |
|
1202 | 1201 | |
|
1203 | 1202 | def __json__(self): |
@@ -1670,7 +1669,7 b' class Repository(Base, BaseModel):' | |||
|
1670 | 1669 | |
|
1671 | 1670 | def __unicode__(self): |
|
1672 | 1671 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1673 |
safe_ |
|
|
1672 | safe_str(self.repo_name)) | |
|
1674 | 1673 | |
|
1675 | 1674 | @hybrid_property |
|
1676 | 1675 | def description_safe(self): |
@@ -1879,7 +1878,7 b' class Repository(Base, BaseModel):' | |||
|
1879 | 1878 | # names in the database, but that eventually needs to be converted |
|
1880 | 1879 | # into a valid system path |
|
1881 | 1880 | p += self.repo_name.split(self.NAME_SEP) |
|
1882 |
return os.path.join(*map(safe_ |
|
|
1881 | return os.path.join(*map(safe_str, p)) | |
|
1883 | 1882 | |
|
1884 | 1883 | @property |
|
1885 | 1884 | def cache_keys(self): |
@@ -2400,7 +2399,7 b' class Repository(Base, BaseModel):' | |||
|
2400 | 2399 | def _get_instance_cached(self): |
|
2401 | 2400 | from rhodecode.lib import rc_cache |
|
2402 | 2401 | |
|
2403 |
cache_namespace_uid = ' |
|
|
2402 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2404 | 2403 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2405 | 2404 | repo_id=self.repo_id) |
|
2406 | 2405 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -3658,7 +3657,7 b' class _PullRequestBase(BaseModel):' | |||
|
3658 | 3657 | if len(parts) != 3: |
|
3659 | 3658 | raise ValueError( |
|
3660 | 3659 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3661 |
self._source_ref = safe_ |
|
|
3660 | self._source_ref = safe_str(val) | |
|
3662 | 3661 | |
|
3663 | 3662 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
3664 | 3663 | |
@@ -3672,7 +3671,7 b' class _PullRequestBase(BaseModel):' | |||
|
3672 | 3671 | if len(parts) != 3: |
|
3673 | 3672 | raise ValueError( |
|
3674 | 3673 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3675 |
self._target_ref = safe_ |
|
|
3674 | self._target_ref = safe_str(val) | |
|
3676 | 3675 | |
|
3677 | 3676 | @declared_attr |
|
3678 | 3677 | def target_repo_id(cls): |
@@ -3784,7 +3783,7 b' class _PullRequestBase(BaseModel):' | |||
|
3784 | 3783 | merge_status = PullRequestModel().merge_status(pull_request) |
|
3785 | 3784 | merge_state = { |
|
3786 | 3785 | 'status': merge_status[0], |
|
3787 |
'message': safe_ |
|
|
3786 | 'message': safe_str(merge_status[1]), | |
|
3788 | 3787 | } |
|
3789 | 3788 | else: |
|
3790 | 3789 | merge_state = {'status': 'not_available', |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -57,7 +56,7 b' from rhodecode.translation import _' | |||
|
57 | 56 | from rhodecode.lib.vcs import get_vcs_instance |
|
58 | 57 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
59 | 58 | from rhodecode.lib.utils2 import ( |
|
60 |
str2bool, safe_str, get_commit_safe, |
|
|
59 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
61 | 60 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
62 | 61 | glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time) |
|
63 | 62 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -321,7 +320,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
321 | 320 | SETTINGS_TYPES = { |
|
322 | 321 | 'str': safe_str, |
|
323 | 322 | 'int': safe_int, |
|
324 |
'unicode': safe_ |
|
|
323 | 'unicode': safe_str, | |
|
325 | 324 | 'bool': str2bool, |
|
326 | 325 | 'list': functools.partial(aslist, sep=',') |
|
327 | 326 | } |
@@ -340,7 +339,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
340 | 339 | |
|
341 | 340 | @validates('_app_settings_value') |
|
342 | 341 | def validate_settings_value(self, key, val): |
|
343 |
assert type(val) == |
|
|
342 | assert type(val) == str | |
|
344 | 343 | return val |
|
345 | 344 | |
|
346 | 345 | @hybrid_property |
@@ -352,7 +351,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
352 | 351 | # decode the encrypted value |
|
353 | 352 | if 'encrypted' in self.app_settings_type: |
|
354 | 353 | cipher = EncryptedTextValue() |
|
355 |
v = safe_ |
|
|
354 | v = safe_str(cipher.process_result_value(v, None)) | |
|
356 | 355 | |
|
357 | 356 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
358 | 357 | self.SETTINGS_TYPES['unicode'] |
@@ -365,11 +364,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
365 | 364 | |
|
366 | 365 | :param val: |
|
367 | 366 | """ |
|
368 |
val = safe_ |
|
|
367 | val = safe_str(val) | |
|
369 | 368 | # encode the encrypted value |
|
370 | 369 | if 'encrypted' in self.app_settings_type: |
|
371 | 370 | cipher = EncryptedTextValue() |
|
372 |
val = safe_ |
|
|
371 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
373 | 372 | self._app_settings_value = val |
|
374 | 373 | |
|
375 | 374 | @hybrid_property |
@@ -481,7 +480,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
481 | 480 | |
|
482 | 481 | @validates('_app_settings_value') |
|
483 | 482 | def validate_settings_value(self, key, val): |
|
484 |
assert type(val) == |
|
|
483 | assert type(val) == str | |
|
485 | 484 | return val |
|
486 | 485 | |
|
487 | 486 | @hybrid_property |
@@ -499,7 +498,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
499 | 498 | |
|
500 | 499 | :param val: |
|
501 | 500 | """ |
|
502 |
self._app_settings_value = safe_ |
|
|
501 | self._app_settings_value = safe_str(val) | |
|
503 | 502 | |
|
504 | 503 | @hybrid_property |
|
505 | 504 | def app_settings_type(self): |
@@ -1214,7 +1213,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1214 | 1213 | |
|
1215 | 1214 | @classmethod |
|
1216 | 1215 | def _get_ip_range(cls, ip_addr): |
|
1217 |
net = ipaddress.ip_network(safe_ |
|
|
1216 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1218 | 1217 | return [str(net.network_address), str(net.broadcast_address)] |
|
1219 | 1218 | |
|
1220 | 1219 | def __json__(self): |
@@ -1688,7 +1687,7 b' class Repository(Base, BaseModel):' | |||
|
1688 | 1687 | |
|
1689 | 1688 | def __unicode__(self): |
|
1690 | 1689 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1691 |
safe_ |
|
|
1690 | safe_str(self.repo_name)) | |
|
1692 | 1691 | |
|
1693 | 1692 | @hybrid_property |
|
1694 | 1693 | def description_safe(self): |
@@ -1903,7 +1902,7 b' class Repository(Base, BaseModel):' | |||
|
1903 | 1902 | # names in the database, but that eventually needs to be converted |
|
1904 | 1903 | # into a valid system path |
|
1905 | 1904 | p += self.repo_name.split(self.NAME_SEP) |
|
1906 |
return os.path.join(*map(safe_ |
|
|
1905 | return os.path.join(*map(safe_str, p)) | |
|
1907 | 1906 | |
|
1908 | 1907 | @property |
|
1909 | 1908 | def cache_keys(self): |
@@ -2460,7 +2459,7 b' class Repository(Base, BaseModel):' | |||
|
2460 | 2459 | def _get_instance_cached(self): |
|
2461 | 2460 | from rhodecode.lib import rc_cache |
|
2462 | 2461 | |
|
2463 |
cache_namespace_uid = ' |
|
|
2462 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2464 | 2463 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2465 | 2464 | repo_id=self.repo_id) |
|
2466 | 2465 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -3904,7 +3903,7 b' class _PullRequestBase(BaseModel):' | |||
|
3904 | 3903 | if len(parts) != 3: |
|
3905 | 3904 | raise ValueError( |
|
3906 | 3905 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3907 |
self._source_ref = safe_ |
|
|
3906 | self._source_ref = safe_str(val) | |
|
3908 | 3907 | |
|
3909 | 3908 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
3910 | 3909 | |
@@ -3918,7 +3917,7 b' class _PullRequestBase(BaseModel):' | |||
|
3918 | 3917 | if len(parts) != 3: |
|
3919 | 3918 | raise ValueError( |
|
3920 | 3919 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3921 |
self._target_ref = safe_ |
|
|
3920 | self._target_ref = safe_str(val) | |
|
3922 | 3921 | |
|
3923 | 3922 | @declared_attr |
|
3924 | 3923 | def target_repo_id(cls): |
@@ -4030,7 +4029,7 b' class _PullRequestBase(BaseModel):' | |||
|
4030 | 4029 | merge_status = PullRequestModel().merge_status(pull_request) |
|
4031 | 4030 | merge_state = { |
|
4032 | 4031 | 'status': merge_status[0], |
|
4033 |
'message': safe_ |
|
|
4032 | 'message': safe_str(merge_status[1]), | |
|
4034 | 4033 | } |
|
4035 | 4034 | else: |
|
4036 | 4035 | merge_state = {'status': 'not_available', |
@@ -5234,7 +5233,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5234 | 5233 | SETTINGS_TYPES = { |
|
5235 | 5234 | 'str': safe_str, |
|
5236 | 5235 | 'int': safe_int, |
|
5237 |
'unicode': safe_ |
|
|
5236 | 'unicode': safe_str, | |
|
5238 | 5237 | 'bool': str2bool, |
|
5239 | 5238 | 'list': functools.partial(aslist, sep=',') |
|
5240 | 5239 | } |
@@ -5300,7 +5299,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5300 | 5299 | # decode the encrypted value if it's encrypted field type |
|
5301 | 5300 | if '.encrypted' in self._file_store_meta_value_type: |
|
5302 | 5301 | cipher = EncryptedTextValue() |
|
5303 |
val = safe_ |
|
|
5302 | val = safe_str(cipher.process_result_value(val, None)) | |
|
5304 | 5303 | # do final type conversion |
|
5305 | 5304 | converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode'] |
|
5306 | 5305 | val = converter(val) |
@@ -5309,11 +5308,11 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5309 | 5308 | |
|
5310 | 5309 | @file_store_meta_value.setter |
|
5311 | 5310 | def file_store_meta_value(self, val): |
|
5312 |
val = safe_ |
|
|
5311 | val = safe_str(val) | |
|
5313 | 5312 | # encode the encrypted value |
|
5314 | 5313 | if '.encrypted' in self.file_store_meta_value_type: |
|
5315 | 5314 | cipher = EncryptedTextValue() |
|
5316 |
val = safe_ |
|
|
5315 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
5317 | 5316 | self._file_store_meta_value = val |
|
5318 | 5317 | |
|
5319 | 5318 | @hybrid_property |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -57,7 +56,7 b' from rhodecode.translation import _' | |||
|
57 | 56 | from rhodecode.lib.vcs import get_vcs_instance, VCSError |
|
58 | 57 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
59 | 58 | from rhodecode.lib.utils2 import ( |
|
60 |
str2bool, safe_str, get_commit_safe, |
|
|
59 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
61 | 60 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
62 | 61 | glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time) |
|
63 | 62 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -321,7 +320,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
321 | 320 | SETTINGS_TYPES = { |
|
322 | 321 | 'str': safe_str, |
|
323 | 322 | 'int': safe_int, |
|
324 |
'unicode': safe_ |
|
|
323 | 'unicode': safe_str, | |
|
325 | 324 | 'bool': str2bool, |
|
326 | 325 | 'list': functools.partial(aslist, sep=',') |
|
327 | 326 | } |
@@ -340,7 +339,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
340 | 339 | |
|
341 | 340 | @validates('_app_settings_value') |
|
342 | 341 | def validate_settings_value(self, key, val): |
|
343 |
assert type(val) == |
|
|
342 | assert type(val) == str | |
|
344 | 343 | return val |
|
345 | 344 | |
|
346 | 345 | @hybrid_property |
@@ -352,7 +351,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
352 | 351 | # decode the encrypted value |
|
353 | 352 | if 'encrypted' in self.app_settings_type: |
|
354 | 353 | cipher = EncryptedTextValue() |
|
355 |
v = safe_ |
|
|
354 | v = safe_str(cipher.process_result_value(v, None)) | |
|
356 | 355 | |
|
357 | 356 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
358 | 357 | self.SETTINGS_TYPES['unicode'] |
@@ -365,11 +364,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
365 | 364 | |
|
366 | 365 | :param val: |
|
367 | 366 | """ |
|
368 |
val = safe_ |
|
|
367 | val = safe_str(val) | |
|
369 | 368 | # encode the encrypted value |
|
370 | 369 | if 'encrypted' in self.app_settings_type: |
|
371 | 370 | cipher = EncryptedTextValue() |
|
372 |
val = safe_ |
|
|
371 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
373 | 372 | self._app_settings_value = val |
|
374 | 373 | |
|
375 | 374 | @hybrid_property |
@@ -481,7 +480,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
481 | 480 | |
|
482 | 481 | @validates('_app_settings_value') |
|
483 | 482 | def validate_settings_value(self, key, val): |
|
484 |
assert type(val) == |
|
|
483 | assert type(val) == str | |
|
485 | 484 | return val |
|
486 | 485 | |
|
487 | 486 | @hybrid_property |
@@ -499,7 +498,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
499 | 498 | |
|
500 | 499 | :param val: |
|
501 | 500 | """ |
|
502 |
self._app_settings_value = safe_ |
|
|
501 | self._app_settings_value = safe_str(val) | |
|
503 | 502 | |
|
504 | 503 | @hybrid_property |
|
505 | 504 | def app_settings_type(self): |
@@ -1267,7 +1266,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1267 | 1266 | |
|
1268 | 1267 | @classmethod |
|
1269 | 1268 | def _get_ip_range(cls, ip_addr): |
|
1270 |
net = ipaddress.ip_network(safe_ |
|
|
1269 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1271 | 1270 | return [str(net.network_address), str(net.broadcast_address)] |
|
1272 | 1271 | |
|
1273 | 1272 | def __json__(self): |
@@ -1742,7 +1741,7 b' class Repository(Base, BaseModel):' | |||
|
1742 | 1741 | |
|
1743 | 1742 | def __unicode__(self): |
|
1744 | 1743 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1745 |
safe_ |
|
|
1744 | safe_str(self.repo_name)) | |
|
1746 | 1745 | |
|
1747 | 1746 | @hybrid_property |
|
1748 | 1747 | def description_safe(self): |
@@ -1961,7 +1960,7 b' class Repository(Base, BaseModel):' | |||
|
1961 | 1960 | # names in the database, but that eventually needs to be converted |
|
1962 | 1961 | # into a valid system path |
|
1963 | 1962 | p += self.repo_name.split(self.NAME_SEP) |
|
1964 |
return os.path.join(*map(safe_ |
|
|
1963 | return os.path.join(*map(safe_str, p)) | |
|
1965 | 1964 | |
|
1966 | 1965 | @property |
|
1967 | 1966 | def cache_keys(self): |
@@ -2545,7 +2544,7 b' class Repository(Base, BaseModel):' | |||
|
2545 | 2544 | def _get_instance_cached(self): |
|
2546 | 2545 | from rhodecode.lib import rc_cache |
|
2547 | 2546 | |
|
2548 |
cache_namespace_uid = ' |
|
|
2547 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2549 | 2548 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2550 | 2549 | repo_id=self.repo_id) |
|
2551 | 2550 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -3992,7 +3991,7 b' class _PullRequestBase(BaseModel):' | |||
|
3992 | 3991 | if len(parts) != 3: |
|
3993 | 3992 | raise ValueError( |
|
3994 | 3993 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
3995 |
self._source_ref = safe_ |
|
|
3994 | self._source_ref = safe_str(val) | |
|
3996 | 3995 | |
|
3997 | 3996 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
3998 | 3997 | |
@@ -4006,7 +4005,7 b' class _PullRequestBase(BaseModel):' | |||
|
4006 | 4005 | if len(parts) != 3: |
|
4007 | 4006 | raise ValueError( |
|
4008 | 4007 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
4009 |
self._target_ref = safe_ |
|
|
4008 | self._target_ref = safe_str(val) | |
|
4010 | 4009 | |
|
4011 | 4010 | @declared_attr |
|
4012 | 4011 | def target_repo_id(cls): |
@@ -4131,7 +4130,7 b' class _PullRequestBase(BaseModel):' | |||
|
4131 | 4130 | PullRequestModel().merge_status(pull_request) |
|
4132 | 4131 | merge_state = { |
|
4133 | 4132 | 'status': merge_status, |
|
4134 |
'message': safe_ |
|
|
4133 | 'message': safe_str(msg), | |
|
4135 | 4134 | } |
|
4136 | 4135 | else: |
|
4137 | 4136 | merge_state = {'status': 'not_available', |
@@ -5403,7 +5402,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5403 | 5402 | SETTINGS_TYPES = { |
|
5404 | 5403 | 'str': safe_str, |
|
5405 | 5404 | 'int': safe_int, |
|
5406 |
'unicode': safe_ |
|
|
5405 | 'unicode': safe_str, | |
|
5407 | 5406 | 'bool': str2bool, |
|
5408 | 5407 | 'list': functools.partial(aslist, sep=',') |
|
5409 | 5408 | } |
@@ -5469,7 +5468,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5469 | 5468 | # decode the encrypted value if it's encrypted field type |
|
5470 | 5469 | if '.encrypted' in self._file_store_meta_value_type: |
|
5471 | 5470 | cipher = EncryptedTextValue() |
|
5472 |
val = safe_ |
|
|
5471 | val = safe_str(cipher.process_result_value(val, None)) | |
|
5473 | 5472 | # do final type conversion |
|
5474 | 5473 | converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode'] |
|
5475 | 5474 | val = converter(val) |
@@ -5478,11 +5477,11 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5478 | 5477 | |
|
5479 | 5478 | @file_store_meta_value.setter |
|
5480 | 5479 | def file_store_meta_value(self, val): |
|
5481 |
val = safe_ |
|
|
5480 | val = safe_str(val) | |
|
5482 | 5481 | # encode the encrypted value |
|
5483 | 5482 | if '.encrypted' in self.file_store_meta_value_type: |
|
5484 | 5483 | cipher = EncryptedTextValue() |
|
5485 |
val = safe_ |
|
|
5484 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
5486 | 5485 | self._file_store_meta_value = val |
|
5487 | 5486 | |
|
5488 | 5487 | @hybrid_property |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -57,7 +56,7 b' from rhodecode.translation import _' | |||
|
57 | 56 | from rhodecode.lib.vcs import get_vcs_instance, VCSError |
|
58 | 57 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
59 | 58 | from rhodecode.lib.utils2 import ( |
|
60 |
str2bool, safe_str, get_commit_safe, |
|
|
59 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
61 | 60 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
62 | 61 | glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time) |
|
63 | 62 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -321,7 +320,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
321 | 320 | SETTINGS_TYPES = { |
|
322 | 321 | 'str': safe_str, |
|
323 | 322 | 'int': safe_int, |
|
324 |
'unicode': safe_ |
|
|
323 | 'unicode': safe_str, | |
|
325 | 324 | 'bool': str2bool, |
|
326 | 325 | 'list': functools.partial(aslist, sep=',') |
|
327 | 326 | } |
@@ -340,7 +339,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
340 | 339 | |
|
341 | 340 | @validates('_app_settings_value') |
|
342 | 341 | def validate_settings_value(self, key, val): |
|
343 |
assert type(val) == |
|
|
342 | assert type(val) == str | |
|
344 | 343 | return val |
|
345 | 344 | |
|
346 | 345 | @hybrid_property |
@@ -352,7 +351,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
352 | 351 | # decode the encrypted value |
|
353 | 352 | if 'encrypted' in self.app_settings_type: |
|
354 | 353 | cipher = EncryptedTextValue() |
|
355 |
v = safe_ |
|
|
354 | v = safe_str(cipher.process_result_value(v, None)) | |
|
356 | 355 | |
|
357 | 356 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
358 | 357 | self.SETTINGS_TYPES['unicode'] |
@@ -365,11 +364,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
365 | 364 | |
|
366 | 365 | :param val: |
|
367 | 366 | """ |
|
368 |
val = safe_ |
|
|
367 | val = safe_str(val) | |
|
369 | 368 | # encode the encrypted value |
|
370 | 369 | if 'encrypted' in self.app_settings_type: |
|
371 | 370 | cipher = EncryptedTextValue() |
|
372 |
val = safe_ |
|
|
371 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
373 | 372 | self._app_settings_value = val |
|
374 | 373 | |
|
375 | 374 | @hybrid_property |
@@ -481,7 +480,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
481 | 480 | |
|
482 | 481 | @validates('_app_settings_value') |
|
483 | 482 | def validate_settings_value(self, key, val): |
|
484 |
assert type(val) == |
|
|
483 | assert type(val) == str | |
|
485 | 484 | return val |
|
486 | 485 | |
|
487 | 486 | @hybrid_property |
@@ -499,7 +498,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
499 | 498 | |
|
500 | 499 | :param val: |
|
501 | 500 | """ |
|
502 |
self._app_settings_value = safe_ |
|
|
501 | self._app_settings_value = safe_str(val) | |
|
503 | 502 | |
|
504 | 503 | @hybrid_property |
|
505 | 504 | def app_settings_type(self): |
@@ -1273,7 +1272,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1273 | 1272 | |
|
1274 | 1273 | @classmethod |
|
1275 | 1274 | def _get_ip_range(cls, ip_addr): |
|
1276 |
net = ipaddress.ip_network(safe_ |
|
|
1275 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1277 | 1276 | return [str(net.network_address), str(net.broadcast_address)] |
|
1278 | 1277 | |
|
1279 | 1278 | def __json__(self): |
@@ -1748,7 +1747,7 b' class Repository(Base, BaseModel):' | |||
|
1748 | 1747 | |
|
1749 | 1748 | def __unicode__(self): |
|
1750 | 1749 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1751 |
safe_ |
|
|
1750 | safe_str(self.repo_name)) | |
|
1752 | 1751 | |
|
1753 | 1752 | @hybrid_property |
|
1754 | 1753 | def description_safe(self): |
@@ -1967,7 +1966,7 b' class Repository(Base, BaseModel):' | |||
|
1967 | 1966 | # names in the database, but that eventually needs to be converted |
|
1968 | 1967 | # into a valid system path |
|
1969 | 1968 | p += self.repo_name.split(self.NAME_SEP) |
|
1970 |
return os.path.join(*map(safe_ |
|
|
1969 | return os.path.join(*map(safe_str, p)) | |
|
1971 | 1970 | |
|
1972 | 1971 | @property |
|
1973 | 1972 | def cache_keys(self): |
@@ -2551,7 +2550,7 b' class Repository(Base, BaseModel):' | |||
|
2551 | 2550 | def _get_instance_cached(self): |
|
2552 | 2551 | from rhodecode.lib import rc_cache |
|
2553 | 2552 | |
|
2554 |
cache_namespace_uid = ' |
|
|
2553 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2555 | 2554 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2556 | 2555 | repo_id=self.repo_id) |
|
2557 | 2556 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -4041,7 +4040,7 b' class _PullRequestBase(BaseModel):' | |||
|
4041 | 4040 | if len(parts) != 3: |
|
4042 | 4041 | raise ValueError( |
|
4043 | 4042 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
4044 |
self._source_ref = safe_ |
|
|
4043 | self._source_ref = safe_str(val) | |
|
4045 | 4044 | |
|
4046 | 4045 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
4047 | 4046 | |
@@ -4055,7 +4054,7 b' class _PullRequestBase(BaseModel):' | |||
|
4055 | 4054 | if len(parts) != 3: |
|
4056 | 4055 | raise ValueError( |
|
4057 | 4056 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
4058 |
self._target_ref = safe_ |
|
|
4057 | self._target_ref = safe_str(val) | |
|
4059 | 4058 | |
|
4060 | 4059 | @declared_attr |
|
4061 | 4060 | def target_repo_id(cls): |
@@ -4180,7 +4179,7 b' class _PullRequestBase(BaseModel):' | |||
|
4180 | 4179 | PullRequestModel().merge_status(pull_request) |
|
4181 | 4180 | merge_state = { |
|
4182 | 4181 | 'status': merge_status, |
|
4183 |
'message': safe_ |
|
|
4182 | 'message': safe_str(msg), | |
|
4184 | 4183 | } |
|
4185 | 4184 | else: |
|
4186 | 4185 | merge_state = {'status': 'not_available', |
@@ -5481,7 +5480,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5481 | 5480 | SETTINGS_TYPES = { |
|
5482 | 5481 | 'str': safe_str, |
|
5483 | 5482 | 'int': safe_int, |
|
5484 |
'unicode': safe_ |
|
|
5483 | 'unicode': safe_str, | |
|
5485 | 5484 | 'bool': str2bool, |
|
5486 | 5485 | 'list': functools.partial(aslist, sep=',') |
|
5487 | 5486 | } |
@@ -5547,7 +5546,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5547 | 5546 | # decode the encrypted value if it's encrypted field type |
|
5548 | 5547 | if '.encrypted' in self._file_store_meta_value_type: |
|
5549 | 5548 | cipher = EncryptedTextValue() |
|
5550 |
val = safe_ |
|
|
5549 | val = safe_str(cipher.process_result_value(val, None)) | |
|
5551 | 5550 | # do final type conversion |
|
5552 | 5551 | converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode'] |
|
5553 | 5552 | val = converter(val) |
@@ -5556,11 +5555,11 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5556 | 5555 | |
|
5557 | 5556 | @file_store_meta_value.setter |
|
5558 | 5557 | def file_store_meta_value(self, val): |
|
5559 |
val = safe_ |
|
|
5558 | val = safe_str(val) | |
|
5560 | 5559 | # encode the encrypted value |
|
5561 | 5560 | if '.encrypted' in self.file_store_meta_value_type: |
|
5562 | 5561 | cipher = EncryptedTextValue() |
|
5563 |
val = safe_ |
|
|
5562 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
5564 | 5563 | self._file_store_meta_value = val |
|
5565 | 5564 | |
|
5566 | 5565 | @hybrid_property |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -57,7 +56,7 b' from rhodecode.translation import _' | |||
|
57 | 56 | from rhodecode.lib.vcs import get_vcs_instance, VCSError |
|
58 | 57 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
59 | 58 | from rhodecode.lib.utils2 import ( |
|
60 |
str2bool, safe_str, get_commit_safe, |
|
|
59 | str2bool, safe_str, get_commit_safe, sha1_safe, | |
|
61 | 60 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
62 | 61 | glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time) |
|
63 | 62 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \ |
@@ -326,7 +325,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
326 | 325 | SETTINGS_TYPES = { |
|
327 | 326 | 'str': safe_str, |
|
328 | 327 | 'int': safe_int, |
|
329 |
'unicode': safe_ |
|
|
328 | 'unicode': safe_str, | |
|
330 | 329 | 'bool': str2bool, |
|
331 | 330 | 'list': functools.partial(aslist, sep=',') |
|
332 | 331 | } |
@@ -345,7 +344,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
345 | 344 | |
|
346 | 345 | @validates('_app_settings_value') |
|
347 | 346 | def validate_settings_value(self, key, val): |
|
348 |
assert type(val) == |
|
|
347 | assert type(val) == str | |
|
349 | 348 | return val |
|
350 | 349 | |
|
351 | 350 | @hybrid_property |
@@ -357,7 +356,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
357 | 356 | # decode the encrypted value |
|
358 | 357 | if 'encrypted' in self.app_settings_type: |
|
359 | 358 | cipher = EncryptedTextValue() |
|
360 |
v = safe_ |
|
|
359 | v = safe_str(cipher.process_result_value(v, None)) | |
|
361 | 360 | |
|
362 | 361 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
363 | 362 | self.SETTINGS_TYPES['unicode'] |
@@ -370,11 +369,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
370 | 369 | |
|
371 | 370 | :param val: |
|
372 | 371 | """ |
|
373 |
val = safe_ |
|
|
372 | val = safe_str(val) | |
|
374 | 373 | # encode the encrypted value |
|
375 | 374 | if 'encrypted' in self.app_settings_type: |
|
376 | 375 | cipher = EncryptedTextValue() |
|
377 |
val = safe_ |
|
|
376 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
378 | 377 | self._app_settings_value = val |
|
379 | 378 | |
|
380 | 379 | @hybrid_property |
@@ -486,7 +485,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
486 | 485 | |
|
487 | 486 | @validates('_app_settings_value') |
|
488 | 487 | def validate_settings_value(self, key, val): |
|
489 |
assert type(val) == |
|
|
488 | assert type(val) == str | |
|
490 | 489 | return val |
|
491 | 490 | |
|
492 | 491 | @hybrid_property |
@@ -504,7 +503,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
504 | 503 | |
|
505 | 504 | :param val: |
|
506 | 505 | """ |
|
507 |
self._app_settings_value = safe_ |
|
|
506 | self._app_settings_value = safe_str(val) | |
|
508 | 507 | |
|
509 | 508 | @hybrid_property |
|
510 | 509 | def app_settings_type(self): |
@@ -1296,7 +1295,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1296 | 1295 | |
|
1297 | 1296 | @classmethod |
|
1298 | 1297 | def _get_ip_range(cls, ip_addr): |
|
1299 |
net = ipaddress.ip_network(safe_ |
|
|
1298 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1300 | 1299 | return [str(net.network_address), str(net.broadcast_address)] |
|
1301 | 1300 | |
|
1302 | 1301 | def __json__(self): |
@@ -1771,7 +1770,7 b' class Repository(Base, BaseModel):' | |||
|
1771 | 1770 | |
|
1772 | 1771 | def __unicode__(self): |
|
1773 | 1772 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1774 |
safe_ |
|
|
1773 | safe_str(self.repo_name)) | |
|
1775 | 1774 | |
|
1776 | 1775 | @hybrid_property |
|
1777 | 1776 | def description_safe(self): |
@@ -1998,7 +1997,7 b' class Repository(Base, BaseModel):' | |||
|
1998 | 1997 | # names in the database, but that eventually needs to be converted |
|
1999 | 1998 | # into a valid system path |
|
2000 | 1999 | p += self.repo_name.split(self.NAME_SEP) |
|
2001 |
return os.path.join(*map(safe_ |
|
|
2000 | return os.path.join(*map(safe_str, p)) | |
|
2002 | 2001 | |
|
2003 | 2002 | @property |
|
2004 | 2003 | def cache_keys(self): |
@@ -2582,7 +2581,7 b' class Repository(Base, BaseModel):' | |||
|
2582 | 2581 | def _get_instance_cached(self): |
|
2583 | 2582 | from rhodecode.lib import rc_cache |
|
2584 | 2583 | |
|
2585 |
cache_namespace_uid = ' |
|
|
2584 | cache_namespace_uid = f'repo_instance.{self.repo_id}' | |
|
2586 | 2585 | invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format( |
|
2587 | 2586 | repo_id=self.repo_id) |
|
2588 | 2587 | region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid) |
@@ -4086,7 +4085,7 b' class _PullRequestBase(BaseModel):' | |||
|
4086 | 4085 | if len(parts) != 3: |
|
4087 | 4086 | raise ValueError( |
|
4088 | 4087 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
4089 |
self._source_ref = safe_ |
|
|
4088 | self._source_ref = safe_str(val) | |
|
4090 | 4089 | |
|
4091 | 4090 | _target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
4092 | 4091 | |
@@ -4100,7 +4099,7 b' class _PullRequestBase(BaseModel):' | |||
|
4100 | 4099 | if len(parts) != 3: |
|
4101 | 4100 | raise ValueError( |
|
4102 | 4101 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) |
|
4103 |
self._target_ref = safe_ |
|
|
4102 | self._target_ref = safe_str(val) | |
|
4104 | 4103 | |
|
4105 | 4104 | @declared_attr |
|
4106 | 4105 | def target_repo_id(cls): |
@@ -4242,7 +4241,7 b' class _PullRequestBase(BaseModel):' | |||
|
4242 | 4241 | PullRequestModel().merge_status(pull_request) |
|
4243 | 4242 | merge_state = { |
|
4244 | 4243 | 'status': merge_status, |
|
4245 |
'message': safe_ |
|
|
4244 | 'message': safe_str(msg), | |
|
4246 | 4245 | } |
|
4247 | 4246 | else: |
|
4248 | 4247 | merge_state = {'status': 'not_available', |
@@ -5545,7 +5544,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5545 | 5544 | SETTINGS_TYPES = { |
|
5546 | 5545 | 'str': safe_str, |
|
5547 | 5546 | 'int': safe_int, |
|
5548 |
'unicode': safe_ |
|
|
5547 | 'unicode': safe_str, | |
|
5549 | 5548 | 'bool': str2bool, |
|
5550 | 5549 | 'list': functools.partial(aslist, sep=',') |
|
5551 | 5550 | } |
@@ -5611,7 +5610,7 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5611 | 5610 | # decode the encrypted value if it's encrypted field type |
|
5612 | 5611 | if '.encrypted' in self._file_store_meta_value_type: |
|
5613 | 5612 | cipher = EncryptedTextValue() |
|
5614 |
val = safe_ |
|
|
5613 | val = safe_str(cipher.process_result_value(val, None)) | |
|
5615 | 5614 | # do final type conversion |
|
5616 | 5615 | converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode'] |
|
5617 | 5616 | val = converter(val) |
@@ -5620,11 +5619,11 b' class FileStoreMetadata(Base, BaseModel)' | |||
|
5620 | 5619 | |
|
5621 | 5620 | @file_store_meta_value.setter |
|
5622 | 5621 | def file_store_meta_value(self, val): |
|
5623 |
val = safe_ |
|
|
5622 | val = safe_str(val) | |
|
5624 | 5623 | # encode the encrypted value |
|
5625 | 5624 | if '.encrypted' in self.file_store_meta_value_type: |
|
5626 | 5625 | cipher = EncryptedTextValue() |
|
5627 |
val = safe_ |
|
|
5626 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
5628 | 5627 | self._file_store_meta_value = val |
|
5629 | 5628 | |
|
5630 | 5629 | @hybrid_property |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -55,7 +54,7 b' from rhodecode.lib.vcs.exceptions import' | |||
|
55 | 54 | from rhodecode.lib.vcs.backends.base import ( |
|
56 | 55 | EmptyCommit, Reference, MergeFailureReason) |
|
57 | 56 | from rhodecode.lib.utils2 import ( |
|
58 |
str2bool, safe_str, get_commit_safe, |
|
|
57 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
59 | 58 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
60 | 59 | from rhodecode.lib.ext_json import json |
|
61 | 60 | from rhodecode.lib.caching_query import FromCache |
@@ -269,7 +268,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
269 | 268 | SETTINGS_TYPES = { |
|
270 | 269 | 'str': safe_str, |
|
271 | 270 | 'int': safe_int, |
|
272 |
'unicode': safe_ |
|
|
271 | 'unicode': safe_str, | |
|
273 | 272 | 'bool': str2bool, |
|
274 | 273 | 'list': functools.partial(aslist, sep=',') |
|
275 | 274 | } |
@@ -288,7 +287,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
288 | 287 | |
|
289 | 288 | @validates('_app_settings_value') |
|
290 | 289 | def validate_settings_value(self, key, val): |
|
291 |
assert type(val) == |
|
|
290 | assert type(val) == str | |
|
292 | 291 | return val |
|
293 | 292 | |
|
294 | 293 | @hybrid_property |
@@ -300,7 +299,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
300 | 299 | # decode the encrypted value |
|
301 | 300 | if 'encrypted' in self.app_settings_type: |
|
302 | 301 | cipher = EncryptedTextValue() |
|
303 |
v = safe_ |
|
|
302 | v = safe_str(cipher.process_result_value(v, None)) | |
|
304 | 303 | |
|
305 | 304 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
306 | 305 | self.SETTINGS_TYPES['unicode'] |
@@ -313,11 +312,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
313 | 312 | |
|
314 | 313 | :param val: |
|
315 | 314 | """ |
|
316 |
val = safe_ |
|
|
315 | val = safe_str(val) | |
|
317 | 316 | # encode the encrypted value |
|
318 | 317 | if 'encrypted' in self.app_settings_type: |
|
319 | 318 | cipher = EncryptedTextValue() |
|
320 |
val = safe_ |
|
|
319 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
321 | 320 | self._app_settings_value = val |
|
322 | 321 | |
|
323 | 322 | @hybrid_property |
@@ -414,7 +413,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
414 | 413 | |
|
415 | 414 | @validates('_app_settings_value') |
|
416 | 415 | def validate_settings_value(self, key, val): |
|
417 |
assert type(val) == |
|
|
416 | assert type(val) == str | |
|
418 | 417 | return val |
|
419 | 418 | |
|
420 | 419 | @hybrid_property |
@@ -432,7 +431,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
432 | 431 | |
|
433 | 432 | :param val: |
|
434 | 433 | """ |
|
435 |
self._app_settings_value = safe_ |
|
|
434 | self._app_settings_value = safe_str(val) | |
|
436 | 435 | |
|
437 | 436 | @hybrid_property |
|
438 | 437 | def app_settings_type(self): |
@@ -1333,7 +1332,7 b' class Repository(Base, BaseModel):' | |||
|
1333 | 1332 | |
|
1334 | 1333 | def __unicode__(self): |
|
1335 | 1334 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1336 |
safe_ |
|
|
1335 | safe_str(self.repo_name)) | |
|
1337 | 1336 | |
|
1338 | 1337 | @hybrid_property |
|
1339 | 1338 | def landing_rev(self): |
@@ -1534,7 +1533,7 b' class Repository(Base, BaseModel):' | |||
|
1534 | 1533 | # names in the database, but that eventually needs to be converted |
|
1535 | 1534 | # into a valid system path |
|
1536 | 1535 | p += self.repo_name.split(self.NAME_SEP) |
|
1537 |
return os.path.join(*map(safe_ |
|
|
1536 | return os.path.join(*map(safe_str, p)) | |
|
1538 | 1537 | |
|
1539 | 1538 | @property |
|
1540 | 1539 | def cache_keys(self): |
@@ -2797,9 +2796,9 b' class CacheKey(Base, BaseModel):' | |||
|
2797 | 2796 | instance_id from .ini file. |
|
2798 | 2797 | """ |
|
2799 | 2798 | import rhodecode |
|
2800 |
prefix = safe_ |
|
|
2801 | ||
|
2802 |
repo_as_unicode = safe_ |
|
|
2799 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2800 | ||
|
2801 | repo_as_unicode = safe_str(repo_name) | |
|
2803 | 2802 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2804 | 2803 | if cache_type else repo_as_unicode |
|
2805 | 2804 | |
@@ -3087,7 +3086,7 b' class PullRequest(Base, _PullRequestBase' | |||
|
3087 | 3086 | 'review_status': pull_request.calculated_review_status(), |
|
3088 | 3087 | 'mergeable': { |
|
3089 | 3088 | 'status': merge_status[0], |
|
3090 |
'message': |
|
|
3089 | 'message': str(merge_status[1]), | |
|
3091 | 3090 | }, |
|
3092 | 3091 | 'source': { |
|
3093 | 3092 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -55,9 +54,9 b' from rhodecode.lib.vcs.exceptions import' | |||
|
55 | 54 | from rhodecode.lib.vcs.backends.base import ( |
|
56 | 55 | EmptyCommit, Reference, MergeFailureReason) |
|
57 | 56 | from rhodecode.lib.utils2 import ( |
|
58 |
str2bool, safe_str, get_commit_safe, |
|
|
57 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
59 | 58 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
60 |
from rhodecode.lib.jsonalchemy import MutationObj, JsonType |
|
|
59 | from rhodecode.lib.jsonalchemy import MutationObj, JsonType | |
|
61 | 60 | from rhodecode.lib.ext_json import json |
|
62 | 61 | from rhodecode.lib.caching_query import FromCache |
|
63 | 62 | from rhodecode.lib.encrypt import AESCipher |
@@ -270,7 +269,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
270 | 269 | SETTINGS_TYPES = { |
|
271 | 270 | 'str': safe_str, |
|
272 | 271 | 'int': safe_int, |
|
273 |
'unicode': safe_ |
|
|
272 | 'unicode': safe_str, | |
|
274 | 273 | 'bool': str2bool, |
|
275 | 274 | 'list': functools.partial(aslist, sep=',') |
|
276 | 275 | } |
@@ -289,7 +288,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
289 | 288 | |
|
290 | 289 | @validates('_app_settings_value') |
|
291 | 290 | def validate_settings_value(self, key, val): |
|
292 |
assert type(val) == |
|
|
291 | assert type(val) == str | |
|
293 | 292 | return val |
|
294 | 293 | |
|
295 | 294 | @hybrid_property |
@@ -301,7 +300,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
301 | 300 | # decode the encrypted value |
|
302 | 301 | if 'encrypted' in self.app_settings_type: |
|
303 | 302 | cipher = EncryptedTextValue() |
|
304 |
v = safe_ |
|
|
303 | v = safe_str(cipher.process_result_value(v, None)) | |
|
305 | 304 | |
|
306 | 305 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
307 | 306 | self.SETTINGS_TYPES['unicode'] |
@@ -314,11 +313,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
314 | 313 | |
|
315 | 314 | :param val: |
|
316 | 315 | """ |
|
317 |
val = safe_ |
|
|
316 | val = safe_str(val) | |
|
318 | 317 | # encode the encrypted value |
|
319 | 318 | if 'encrypted' in self.app_settings_type: |
|
320 | 319 | cipher = EncryptedTextValue() |
|
321 |
val = safe_ |
|
|
320 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
322 | 321 | self._app_settings_value = val |
|
323 | 322 | |
|
324 | 323 | @hybrid_property |
@@ -415,7 +414,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
415 | 414 | |
|
416 | 415 | @validates('_app_settings_value') |
|
417 | 416 | def validate_settings_value(self, key, val): |
|
418 |
assert type(val) == |
|
|
417 | assert type(val) == str | |
|
419 | 418 | return val |
|
420 | 419 | |
|
421 | 420 | @hybrid_property |
@@ -433,7 +432,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
433 | 432 | |
|
434 | 433 | :param val: |
|
435 | 434 | """ |
|
436 |
self._app_settings_value = safe_ |
|
|
435 | self._app_settings_value = safe_str(val) | |
|
437 | 436 | |
|
438 | 437 | @hybrid_property |
|
439 | 438 | def app_settings_type(self): |
@@ -1336,7 +1335,7 b' class Repository(Base, BaseModel):' | |||
|
1336 | 1335 | |
|
1337 | 1336 | def __unicode__(self): |
|
1338 | 1337 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1339 |
safe_ |
|
|
1338 | safe_str(self.repo_name)) | |
|
1340 | 1339 | |
|
1341 | 1340 | @hybrid_property |
|
1342 | 1341 | def landing_rev(self): |
@@ -1537,7 +1536,7 b' class Repository(Base, BaseModel):' | |||
|
1537 | 1536 | # names in the database, but that eventually needs to be converted |
|
1538 | 1537 | # into a valid system path |
|
1539 | 1538 | p += self.repo_name.split(self.NAME_SEP) |
|
1540 |
return os.path.join(*map(safe_ |
|
|
1539 | return os.path.join(*map(safe_str, p)) | |
|
1541 | 1540 | |
|
1542 | 1541 | @property |
|
1543 | 1542 | def cache_keys(self): |
@@ -2789,9 +2788,9 b' class CacheKey(Base, BaseModel):' | |||
|
2789 | 2788 | instance_id from .ini file. |
|
2790 | 2789 | """ |
|
2791 | 2790 | import rhodecode |
|
2792 |
prefix = safe_ |
|
|
2793 | ||
|
2794 |
repo_as_unicode = safe_ |
|
|
2791 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2792 | ||
|
2793 | repo_as_unicode = safe_str(repo_name) | |
|
2795 | 2794 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2796 | 2795 | if cache_type else repo_as_unicode |
|
2797 | 2796 | |
@@ -3079,7 +3078,7 b' class PullRequest(Base, _PullRequestBase' | |||
|
3079 | 3078 | 'review_status': pull_request.calculated_review_status(), |
|
3080 | 3079 | 'mergeable': { |
|
3081 | 3080 | 'status': merge_status[0], |
|
3082 |
'message': |
|
|
3081 | 'message': str(merge_status[1]), | |
|
3083 | 3082 | }, |
|
3084 | 3083 | 'source': { |
|
3085 | 3084 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -54,9 +53,9 b' from rhodecode.lib.vcs.exceptions import' | |||
|
54 | 53 | from rhodecode.lib.vcs.backends.base import ( |
|
55 | 54 | EmptyCommit, Reference, MergeFailureReason) |
|
56 | 55 | from rhodecode.lib.utils2 import ( |
|
57 |
str2bool, safe_str, get_commit_safe, |
|
|
56 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
58 | 57 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict) |
|
59 |
from rhodecode.lib.jsonalchemy import MutationObj, JsonType |
|
|
58 | from rhodecode.lib.jsonalchemy import MutationObj, JsonType | |
|
60 | 59 | from rhodecode.lib.ext_json import json |
|
61 | 60 | from rhodecode.lib.caching_query import FromCache |
|
62 | 61 | from rhodecode.lib.encrypt import AESCipher |
@@ -269,7 +268,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
269 | 268 | SETTINGS_TYPES = { |
|
270 | 269 | 'str': safe_str, |
|
271 | 270 | 'int': safe_int, |
|
272 |
'unicode': safe_ |
|
|
271 | 'unicode': safe_str, | |
|
273 | 272 | 'bool': str2bool, |
|
274 | 273 | 'list': functools.partial(aslist, sep=',') |
|
275 | 274 | } |
@@ -288,7 +287,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
288 | 287 | |
|
289 | 288 | @validates('_app_settings_value') |
|
290 | 289 | def validate_settings_value(self, key, val): |
|
291 |
assert type(val) == |
|
|
290 | assert type(val) == str | |
|
292 | 291 | return val |
|
293 | 292 | |
|
294 | 293 | @hybrid_property |
@@ -300,7 +299,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
300 | 299 | # decode the encrypted value |
|
301 | 300 | if 'encrypted' in self.app_settings_type: |
|
302 | 301 | cipher = EncryptedTextValue() |
|
303 |
v = safe_ |
|
|
302 | v = safe_str(cipher.process_result_value(v, None)) | |
|
304 | 303 | |
|
305 | 304 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
306 | 305 | self.SETTINGS_TYPES['unicode'] |
@@ -313,11 +312,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
313 | 312 | |
|
314 | 313 | :param val: |
|
315 | 314 | """ |
|
316 |
val = safe_ |
|
|
315 | val = safe_str(val) | |
|
317 | 316 | # encode the encrypted value |
|
318 | 317 | if 'encrypted' in self.app_settings_type: |
|
319 | 318 | cipher = EncryptedTextValue() |
|
320 |
val = safe_ |
|
|
319 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
321 | 320 | self._app_settings_value = val |
|
322 | 321 | |
|
323 | 322 | @hybrid_property |
@@ -414,7 +413,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
414 | 413 | |
|
415 | 414 | @validates('_app_settings_value') |
|
416 | 415 | def validate_settings_value(self, key, val): |
|
417 |
assert type(val) == |
|
|
416 | assert type(val) == str | |
|
418 | 417 | return val |
|
419 | 418 | |
|
420 | 419 | @hybrid_property |
@@ -432,7 +431,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
432 | 431 | |
|
433 | 432 | :param val: |
|
434 | 433 | """ |
|
435 |
self._app_settings_value = safe_ |
|
|
434 | self._app_settings_value = safe_str(val) | |
|
436 | 435 | |
|
437 | 436 | @hybrid_property |
|
438 | 437 | def app_settings_type(self): |
@@ -1335,7 +1334,7 b' class Repository(Base, BaseModel):' | |||
|
1335 | 1334 | |
|
1336 | 1335 | def __unicode__(self): |
|
1337 | 1336 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1338 |
safe_ |
|
|
1337 | safe_str(self.repo_name)) | |
|
1339 | 1338 | |
|
1340 | 1339 | @hybrid_property |
|
1341 | 1340 | def landing_rev(self): |
@@ -1536,7 +1535,7 b' class Repository(Base, BaseModel):' | |||
|
1536 | 1535 | # names in the database, but that eventually needs to be converted |
|
1537 | 1536 | # into a valid system path |
|
1538 | 1537 | p += self.repo_name.split(self.NAME_SEP) |
|
1539 |
return os.path.join(*map(safe_ |
|
|
1538 | return os.path.join(*map(safe_str, p)) | |
|
1540 | 1539 | |
|
1541 | 1540 | @property |
|
1542 | 1541 | def cache_keys(self): |
@@ -2788,9 +2787,9 b' class CacheKey(Base, BaseModel):' | |||
|
2788 | 2787 | instance_id from .ini file. |
|
2789 | 2788 | """ |
|
2790 | 2789 | import rhodecode |
|
2791 |
prefix = safe_ |
|
|
2792 | ||
|
2793 |
repo_as_unicode = safe_ |
|
|
2790 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2791 | ||
|
2792 | repo_as_unicode = safe_str(repo_name) | |
|
2794 | 2793 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2795 | 2794 | if cache_type else repo_as_unicode |
|
2796 | 2795 | |
@@ -3079,7 +3078,7 b' class PullRequest(Base, _PullRequestBase' | |||
|
3079 | 3078 | 'review_status': pull_request.calculated_review_status(), |
|
3080 | 3079 | 'mergeable': { |
|
3081 | 3080 | 'status': merge_status[0], |
|
3082 |
'message': |
|
|
3081 | 'message': str(merge_status[1]), | |
|
3083 | 3082 | }, |
|
3084 | 3083 | 'source': { |
|
3085 | 3084 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -55,10 +54,10 b' from rhodecode.lib.vcs.exceptions import' | |||
|
55 | 54 | from rhodecode.lib.vcs.backends.base import ( |
|
56 | 55 | EmptyCommit, Reference, MergeFailureReason) |
|
57 | 56 | from rhodecode.lib.utils2 import ( |
|
58 |
str2bool, safe_str, get_commit_safe, |
|
|
57 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
59 | 58 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
60 | 59 | glob2re) |
|
61 |
from rhodecode.lib.jsonalchemy import MutationObj, JsonType |
|
|
60 | from rhodecode.lib.jsonalchemy import MutationObj, JsonType | |
|
62 | 61 | from rhodecode.lib.ext_json import json |
|
63 | 62 | from rhodecode.lib.caching_query import FromCache |
|
64 | 63 | from rhodecode.lib.encrypt import AESCipher |
@@ -271,7 +270,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
271 | 270 | SETTINGS_TYPES = { |
|
272 | 271 | 'str': safe_str, |
|
273 | 272 | 'int': safe_int, |
|
274 |
'unicode': safe_ |
|
|
273 | 'unicode': safe_str, | |
|
275 | 274 | 'bool': str2bool, |
|
276 | 275 | 'list': functools.partial(aslist, sep=',') |
|
277 | 276 | } |
@@ -290,7 +289,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
290 | 289 | |
|
291 | 290 | @validates('_app_settings_value') |
|
292 | 291 | def validate_settings_value(self, key, val): |
|
293 |
assert type(val) == |
|
|
292 | assert type(val) == str | |
|
294 | 293 | return val |
|
295 | 294 | |
|
296 | 295 | @hybrid_property |
@@ -302,7 +301,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
302 | 301 | # decode the encrypted value |
|
303 | 302 | if 'encrypted' in self.app_settings_type: |
|
304 | 303 | cipher = EncryptedTextValue() |
|
305 |
v = safe_ |
|
|
304 | v = safe_str(cipher.process_result_value(v, None)) | |
|
306 | 305 | |
|
307 | 306 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
308 | 307 | self.SETTINGS_TYPES['unicode'] |
@@ -315,11 +314,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
315 | 314 | |
|
316 | 315 | :param val: |
|
317 | 316 | """ |
|
318 |
val = safe_ |
|
|
317 | val = safe_str(val) | |
|
319 | 318 | # encode the encrypted value |
|
320 | 319 | if 'encrypted' in self.app_settings_type: |
|
321 | 320 | cipher = EncryptedTextValue() |
|
322 |
val = safe_ |
|
|
321 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
323 | 322 | self._app_settings_value = val |
|
324 | 323 | |
|
325 | 324 | @hybrid_property |
@@ -416,7 +415,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
416 | 415 | |
|
417 | 416 | @validates('_app_settings_value') |
|
418 | 417 | def validate_settings_value(self, key, val): |
|
419 |
assert type(val) == |
|
|
418 | assert type(val) == str | |
|
420 | 419 | return val |
|
421 | 420 | |
|
422 | 421 | @hybrid_property |
@@ -434,7 +433,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
434 | 433 | |
|
435 | 434 | :param val: |
|
436 | 435 | """ |
|
437 |
self._app_settings_value = safe_ |
|
|
436 | self._app_settings_value = safe_str(val) | |
|
438 | 437 | |
|
439 | 438 | @hybrid_property |
|
440 | 439 | def app_settings_type(self): |
@@ -1337,7 +1336,7 b' class Repository(Base, BaseModel):' | |||
|
1337 | 1336 | |
|
1338 | 1337 | def __unicode__(self): |
|
1339 | 1338 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1340 |
safe_ |
|
|
1339 | safe_str(self.repo_name)) | |
|
1341 | 1340 | |
|
1342 | 1341 | @hybrid_property |
|
1343 | 1342 | def landing_rev(self): |
@@ -1538,7 +1537,7 b' class Repository(Base, BaseModel):' | |||
|
1538 | 1537 | # names in the database, but that eventually needs to be converted |
|
1539 | 1538 | # into a valid system path |
|
1540 | 1539 | p += self.repo_name.split(self.NAME_SEP) |
|
1541 |
return os.path.join(*map(safe_ |
|
|
1540 | return os.path.join(*map(safe_str, p)) | |
|
1542 | 1541 | |
|
1543 | 1542 | @property |
|
1544 | 1543 | def cache_keys(self): |
@@ -2792,9 +2791,9 b' class CacheKey(Base, BaseModel):' | |||
|
2792 | 2791 | instance_id from .ini file. |
|
2793 | 2792 | """ |
|
2794 | 2793 | import rhodecode |
|
2795 |
prefix = safe_ |
|
|
2796 | ||
|
2797 |
repo_as_unicode = safe_ |
|
|
2794 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2795 | ||
|
2796 | repo_as_unicode = safe_str(repo_name) | |
|
2798 | 2797 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2799 | 2798 | if cache_type else repo_as_unicode |
|
2800 | 2799 | |
@@ -3082,7 +3081,7 b' class PullRequest(Base, _PullRequestBase' | |||
|
3082 | 3081 | 'review_status': pull_request.calculated_review_status(), |
|
3083 | 3082 | 'mergeable': { |
|
3084 | 3083 | 'status': merge_status[0], |
|
3085 |
'message': |
|
|
3084 | 'message': str(merge_status[1]), | |
|
3086 | 3085 | }, |
|
3087 | 3086 | 'source': { |
|
3088 | 3087 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -55,10 +54,10 b' from rhodecode.lib.vcs.exceptions import' | |||
|
55 | 54 | from rhodecode.lib.vcs.backends.base import ( |
|
56 | 55 | EmptyCommit, Reference, MergeFailureReason) |
|
57 | 56 | from rhodecode.lib.utils2 import ( |
|
58 |
str2bool, safe_str, get_commit_safe, |
|
|
57 | str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe, | |
|
59 | 58 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
60 | 59 | glob2re) |
|
61 |
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType |
|
|
60 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType | |
|
62 | 61 | from rhodecode.lib.ext_json import json |
|
63 | 62 | from rhodecode.lib.caching_query import FromCache |
|
64 | 63 | from rhodecode.lib.encrypt import AESCipher |
@@ -271,7 +270,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
271 | 270 | SETTINGS_TYPES = { |
|
272 | 271 | 'str': safe_str, |
|
273 | 272 | 'int': safe_int, |
|
274 |
'unicode': safe_ |
|
|
273 | 'unicode': safe_str, | |
|
275 | 274 | 'bool': str2bool, |
|
276 | 275 | 'list': functools.partial(aslist, sep=',') |
|
277 | 276 | } |
@@ -290,7 +289,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
290 | 289 | |
|
291 | 290 | @validates('_app_settings_value') |
|
292 | 291 | def validate_settings_value(self, key, val): |
|
293 |
assert type(val) == |
|
|
292 | assert type(val) == str | |
|
294 | 293 | return val |
|
295 | 294 | |
|
296 | 295 | @hybrid_property |
@@ -302,7 +301,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
302 | 301 | # decode the encrypted value |
|
303 | 302 | if 'encrypted' in self.app_settings_type: |
|
304 | 303 | cipher = EncryptedTextValue() |
|
305 |
v = safe_ |
|
|
304 | v = safe_str(cipher.process_result_value(v, None)) | |
|
306 | 305 | |
|
307 | 306 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
308 | 307 | self.SETTINGS_TYPES['unicode'] |
@@ -315,11 +314,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
315 | 314 | |
|
316 | 315 | :param val: |
|
317 | 316 | """ |
|
318 |
val = safe_ |
|
|
317 | val = safe_str(val) | |
|
319 | 318 | # encode the encrypted value |
|
320 | 319 | if 'encrypted' in self.app_settings_type: |
|
321 | 320 | cipher = EncryptedTextValue() |
|
322 |
val = safe_ |
|
|
321 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
323 | 322 | self._app_settings_value = val |
|
324 | 323 | |
|
325 | 324 | @hybrid_property |
@@ -416,7 +415,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
416 | 415 | |
|
417 | 416 | @validates('_app_settings_value') |
|
418 | 417 | def validate_settings_value(self, key, val): |
|
419 |
assert type(val) == |
|
|
418 | assert type(val) == str | |
|
420 | 419 | return val |
|
421 | 420 | |
|
422 | 421 | @hybrid_property |
@@ -434,7 +433,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
434 | 433 | |
|
435 | 434 | :param val: |
|
436 | 435 | """ |
|
437 |
self._app_settings_value = safe_ |
|
|
436 | self._app_settings_value = safe_str(val) | |
|
438 | 437 | |
|
439 | 438 | @hybrid_property |
|
440 | 439 | def app_settings_type(self): |
@@ -1337,7 +1336,7 b' class Repository(Base, BaseModel):' | |||
|
1337 | 1336 | |
|
1338 | 1337 | def __unicode__(self): |
|
1339 | 1338 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1340 |
safe_ |
|
|
1339 | safe_str(self.repo_name)) | |
|
1341 | 1340 | |
|
1342 | 1341 | @hybrid_property |
|
1343 | 1342 | def landing_rev(self): |
@@ -1538,7 +1537,7 b' class Repository(Base, BaseModel):' | |||
|
1538 | 1537 | # names in the database, but that eventually needs to be converted |
|
1539 | 1538 | # into a valid system path |
|
1540 | 1539 | p += self.repo_name.split(self.NAME_SEP) |
|
1541 |
return os.path.join(*map(safe_ |
|
|
1540 | return os.path.join(*map(safe_str, p)) | |
|
1542 | 1541 | |
|
1543 | 1542 | @property |
|
1544 | 1543 | def cache_keys(self): |
@@ -2792,9 +2791,9 b' class CacheKey(Base, BaseModel):' | |||
|
2792 | 2791 | instance_id from .ini file. |
|
2793 | 2792 | """ |
|
2794 | 2793 | import rhodecode |
|
2795 |
prefix = safe_ |
|
|
2796 | ||
|
2797 |
repo_as_unicode = safe_ |
|
|
2794 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2795 | ||
|
2796 | repo_as_unicode = safe_str(repo_name) | |
|
2798 | 2797 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2799 | 2798 | if cache_type else repo_as_unicode |
|
2800 | 2799 | |
@@ -3082,7 +3081,7 b' class PullRequest(Base, _PullRequestBase' | |||
|
3082 | 3081 | 'review_status': pull_request.calculated_review_status(), |
|
3083 | 3082 | 'mergeable': { |
|
3084 | 3083 | 'status': merge_status[0], |
|
3085 |
'message': |
|
|
3084 | 'message': str(merge_status[1]), | |
|
3086 | 3085 | }, |
|
3087 | 3086 | 'source': { |
|
3088 | 3087 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -51,7 +50,7 b' from rhodecode.translation import _' | |||
|
51 | 50 | from rhodecode.lib.vcs import get_vcs_instance |
|
52 | 51 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
53 | 52 | from rhodecode.lib.utils2 import ( |
|
54 |
str2bool, safe_str, get_commit_safe, |
|
|
53 | str2bool, safe_str, get_commit_safe, md5_safe, | |
|
55 | 54 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
56 | 55 | glob2re, StrictAttributeDict, cleaned_uri) |
|
57 | 56 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType |
@@ -267,7 +266,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
267 | 266 | SETTINGS_TYPES = { |
|
268 | 267 | 'str': safe_str, |
|
269 | 268 | 'int': safe_int, |
|
270 |
'unicode': safe_ |
|
|
269 | 'unicode': safe_str, | |
|
271 | 270 | 'bool': str2bool, |
|
272 | 271 | 'list': functools.partial(aslist, sep=',') |
|
273 | 272 | } |
@@ -286,7 +285,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
286 | 285 | |
|
287 | 286 | @validates('_app_settings_value') |
|
288 | 287 | def validate_settings_value(self, key, val): |
|
289 |
assert type(val) == |
|
|
288 | assert type(val) == str | |
|
290 | 289 | return val |
|
291 | 290 | |
|
292 | 291 | @hybrid_property |
@@ -298,7 +297,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
298 | 297 | # decode the encrypted value |
|
299 | 298 | if 'encrypted' in self.app_settings_type: |
|
300 | 299 | cipher = EncryptedTextValue() |
|
301 |
v = safe_ |
|
|
300 | v = safe_str(cipher.process_result_value(v, None)) | |
|
302 | 301 | |
|
303 | 302 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
304 | 303 | self.SETTINGS_TYPES['unicode'] |
@@ -311,11 +310,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
311 | 310 | |
|
312 | 311 | :param val: |
|
313 | 312 | """ |
|
314 |
val = safe_ |
|
|
313 | val = safe_str(val) | |
|
315 | 314 | # encode the encrypted value |
|
316 | 315 | if 'encrypted' in self.app_settings_type: |
|
317 | 316 | cipher = EncryptedTextValue() |
|
318 |
val = safe_ |
|
|
317 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
319 | 318 | self._app_settings_value = val |
|
320 | 319 | |
|
321 | 320 | @hybrid_property |
@@ -413,7 +412,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
413 | 412 | |
|
414 | 413 | @validates('_app_settings_value') |
|
415 | 414 | def validate_settings_value(self, key, val): |
|
416 |
assert type(val) == |
|
|
415 | assert type(val) == str | |
|
417 | 416 | return val |
|
418 | 417 | |
|
419 | 418 | @hybrid_property |
@@ -431,7 +430,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
431 | 430 | |
|
432 | 431 | :param val: |
|
433 | 432 | """ |
|
434 |
self._app_settings_value = safe_ |
|
|
433 | self._app_settings_value = safe_str(val) | |
|
435 | 434 | |
|
436 | 435 | @hybrid_property |
|
437 | 436 | def app_settings_type(self): |
@@ -1380,7 +1379,7 b' class Repository(Base, BaseModel):' | |||
|
1380 | 1379 | |
|
1381 | 1380 | def __unicode__(self): |
|
1382 | 1381 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1383 |
safe_ |
|
|
1382 | safe_str(self.repo_name)) | |
|
1384 | 1383 | |
|
1385 | 1384 | @hybrid_property |
|
1386 | 1385 | def landing_rev(self): |
@@ -1581,7 +1580,7 b' class Repository(Base, BaseModel):' | |||
|
1581 | 1580 | # names in the database, but that eventually needs to be converted |
|
1582 | 1581 | # into a valid system path |
|
1583 | 1582 | p += self.repo_name.split(self.NAME_SEP) |
|
1584 |
return os.path.join(*map(safe_ |
|
|
1583 | return os.path.join(*map(safe_str, p)) | |
|
1585 | 1584 | |
|
1586 | 1585 | @property |
|
1587 | 1586 | def cache_keys(self): |
@@ -2848,9 +2847,9 b' class CacheKey(Base, BaseModel):' | |||
|
2848 | 2847 | instance_id from .ini file. |
|
2849 | 2848 | """ |
|
2850 | 2849 | import rhodecode |
|
2851 |
prefix = safe_ |
|
|
2852 | ||
|
2853 |
repo_as_unicode = safe_ |
|
|
2850 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2851 | ||
|
2852 | repo_as_unicode = safe_str(repo_name) | |
|
2854 | 2853 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2855 | 2854 | if cache_type else repo_as_unicode |
|
2856 | 2855 | |
@@ -3193,7 +3192,7 b' class _PullRequestBase(BaseModel):' | |||
|
3193 | 3192 | 'review_status': pull_request.calculated_review_status(), |
|
3194 | 3193 | 'mergeable': { |
|
3195 | 3194 | 'status': merge_status[0], |
|
3196 |
'message': |
|
|
3195 | 'message': str(merge_status[1]), | |
|
3197 | 3196 | }, |
|
3198 | 3197 | 'source': { |
|
3199 | 3198 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -51,7 +50,7 b' from rhodecode.translation import _' | |||
|
51 | 50 | from rhodecode.lib.vcs import get_vcs_instance |
|
52 | 51 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
53 | 52 | from rhodecode.lib.utils2 import ( |
|
54 |
str2bool, safe_str, get_commit_safe, |
|
|
53 | str2bool, safe_str, get_commit_safe, md5_safe, | |
|
55 | 54 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
56 | 55 | glob2re, StrictAttributeDict, cleaned_uri) |
|
57 | 56 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType |
@@ -267,7 +266,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
267 | 266 | SETTINGS_TYPES = { |
|
268 | 267 | 'str': safe_str, |
|
269 | 268 | 'int': safe_int, |
|
270 |
'unicode': safe_ |
|
|
269 | 'unicode': safe_str, | |
|
271 | 270 | 'bool': str2bool, |
|
272 | 271 | 'list': functools.partial(aslist, sep=',') |
|
273 | 272 | } |
@@ -286,7 +285,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
286 | 285 | |
|
287 | 286 | @validates('_app_settings_value') |
|
288 | 287 | def validate_settings_value(self, key, val): |
|
289 |
assert type(val) == |
|
|
288 | assert type(val) == str | |
|
290 | 289 | return val |
|
291 | 290 | |
|
292 | 291 | @hybrid_property |
@@ -298,7 +297,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
298 | 297 | # decode the encrypted value |
|
299 | 298 | if 'encrypted' in self.app_settings_type: |
|
300 | 299 | cipher = EncryptedTextValue() |
|
301 |
v = safe_ |
|
|
300 | v = safe_str(cipher.process_result_value(v, None)) | |
|
302 | 301 | |
|
303 | 302 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
304 | 303 | self.SETTINGS_TYPES['unicode'] |
@@ -311,11 +310,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
311 | 310 | |
|
312 | 311 | :param val: |
|
313 | 312 | """ |
|
314 |
val = safe_ |
|
|
313 | val = safe_str(val) | |
|
315 | 314 | # encode the encrypted value |
|
316 | 315 | if 'encrypted' in self.app_settings_type: |
|
317 | 316 | cipher = EncryptedTextValue() |
|
318 |
val = safe_ |
|
|
317 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
319 | 318 | self._app_settings_value = val |
|
320 | 319 | |
|
321 | 320 | @hybrid_property |
@@ -413,7 +412,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
413 | 412 | |
|
414 | 413 | @validates('_app_settings_value') |
|
415 | 414 | def validate_settings_value(self, key, val): |
|
416 |
assert type(val) == |
|
|
415 | assert type(val) == str | |
|
417 | 416 | return val |
|
418 | 417 | |
|
419 | 418 | @hybrid_property |
@@ -431,7 +430,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
431 | 430 | |
|
432 | 431 | :param val: |
|
433 | 432 | """ |
|
434 |
self._app_settings_value = safe_ |
|
|
433 | self._app_settings_value = safe_str(val) | |
|
435 | 434 | |
|
436 | 435 | @hybrid_property |
|
437 | 436 | def app_settings_type(self): |
@@ -1381,7 +1380,7 b' class Repository(Base, BaseModel):' | |||
|
1381 | 1380 | |
|
1382 | 1381 | def __unicode__(self): |
|
1383 | 1382 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1384 |
safe_ |
|
|
1383 | safe_str(self.repo_name)) | |
|
1385 | 1384 | |
|
1386 | 1385 | @hybrid_property |
|
1387 | 1386 | def landing_rev(self): |
@@ -1582,7 +1581,7 b' class Repository(Base, BaseModel):' | |||
|
1582 | 1581 | # names in the database, but that eventually needs to be converted |
|
1583 | 1582 | # into a valid system path |
|
1584 | 1583 | p += self.repo_name.split(self.NAME_SEP) |
|
1585 |
return os.path.join(*map(safe_ |
|
|
1584 | return os.path.join(*map(safe_str, p)) | |
|
1586 | 1585 | |
|
1587 | 1586 | @property |
|
1588 | 1587 | def cache_keys(self): |
@@ -2849,9 +2848,9 b' class CacheKey(Base, BaseModel):' | |||
|
2849 | 2848 | instance_id from .ini file. |
|
2850 | 2849 | """ |
|
2851 | 2850 | import rhodecode |
|
2852 |
prefix = safe_ |
|
|
2853 | ||
|
2854 |
repo_as_unicode = safe_ |
|
|
2851 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
2852 | ||
|
2853 | repo_as_unicode = safe_str(repo_name) | |
|
2855 | 2854 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
2856 | 2855 | if cache_type else repo_as_unicode |
|
2857 | 2856 | |
@@ -3194,7 +3193,7 b' class _PullRequestBase(BaseModel):' | |||
|
3194 | 3193 | 'review_status': pull_request.calculated_review_status(), |
|
3195 | 3194 | 'mergeable': { |
|
3196 | 3195 | 'status': merge_status[0], |
|
3197 |
'message': |
|
|
3196 | 'message': str(merge_status[1]), | |
|
3198 | 3197 | }, |
|
3199 | 3198 | 'source': { |
|
3200 | 3199 | 'clone_url': pull_request.source_repo.clone_url(), |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 | |
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -49,7 +48,7 b' from rhodecode.translation import _' | |||
|
49 | 48 | from rhodecode.lib.vcs import get_vcs_instance |
|
50 | 49 | from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference |
|
51 | 50 | from rhodecode.lib.utils2 import ( |
|
52 |
str2bool, safe_str, get_commit_safe, |
|
|
51 | str2bool, safe_str, get_commit_safe, md5_safe, | |
|
53 | 52 | time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict, |
|
54 | 53 | glob2re, StrictAttributeDict, cleaned_uri) |
|
55 | 54 | from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType |
@@ -267,7 +266,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
267 | 266 | SETTINGS_TYPES = { |
|
268 | 267 | 'str': safe_str, |
|
269 | 268 | 'int': safe_int, |
|
270 |
'unicode': safe_ |
|
|
269 | 'unicode': safe_str, | |
|
271 | 270 | 'bool': str2bool, |
|
272 | 271 | 'list': functools.partial(aslist, sep=',') |
|
273 | 272 | } |
@@ -286,7 +285,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
286 | 285 | |
|
287 | 286 | @validates('_app_settings_value') |
|
288 | 287 | def validate_settings_value(self, key, val): |
|
289 |
assert type(val) == |
|
|
288 | assert type(val) == str | |
|
290 | 289 | return val |
|
291 | 290 | |
|
292 | 291 | @hybrid_property |
@@ -298,7 +297,7 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
298 | 297 | # decode the encrypted value |
|
299 | 298 | if 'encrypted' in self.app_settings_type: |
|
300 | 299 | cipher = EncryptedTextValue() |
|
301 |
v = safe_ |
|
|
300 | v = safe_str(cipher.process_result_value(v, None)) | |
|
302 | 301 | |
|
303 | 302 | converter = self.SETTINGS_TYPES.get(_type) or \ |
|
304 | 303 | self.SETTINGS_TYPES['unicode'] |
@@ -311,11 +310,11 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
311 | 310 | |
|
312 | 311 | :param val: |
|
313 | 312 | """ |
|
314 |
val = safe_ |
|
|
313 | val = safe_str(val) | |
|
315 | 314 | # encode the encrypted value |
|
316 | 315 | if 'encrypted' in self.app_settings_type: |
|
317 | 316 | cipher = EncryptedTextValue() |
|
318 |
val = safe_ |
|
|
317 | val = safe_str(cipher.process_bind_param(val, None)) | |
|
319 | 318 | self._app_settings_value = val |
|
320 | 319 | |
|
321 | 320 | @hybrid_property |
@@ -414,7 +413,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
414 | 413 | |
|
415 | 414 | @validates('_app_settings_value') |
|
416 | 415 | def validate_settings_value(self, key, val): |
|
417 |
assert type(val) == |
|
|
416 | assert type(val) == str | |
|
418 | 417 | return val |
|
419 | 418 | |
|
420 | 419 | @hybrid_property |
@@ -432,7 +431,7 b' class RepoRhodeCodeSetting(Base, BaseMod' | |||
|
432 | 431 | |
|
433 | 432 | :param val: |
|
434 | 433 | """ |
|
435 |
self._app_settings_value = safe_ |
|
|
434 | self._app_settings_value = safe_str(val) | |
|
436 | 435 | |
|
437 | 436 | @hybrid_property |
|
438 | 437 | def app_settings_type(self): |
@@ -1129,7 +1128,7 b' class UserIpMap(Base, BaseModel):' | |||
|
1129 | 1128 | |
|
1130 | 1129 | @classmethod |
|
1131 | 1130 | def _get_ip_range(cls, ip_addr): |
|
1132 |
net = ipaddress.ip_network(safe_ |
|
|
1131 | net = ipaddress.ip_network(safe_str(ip_addr), strict=False) | |
|
1133 | 1132 | return [str(net.network_address), str(net.broadcast_address)] |
|
1134 | 1133 | |
|
1135 | 1134 | def __json__(self): |
@@ -1558,7 +1557,7 b' class Repository(Base, BaseModel):' | |||
|
1558 | 1557 | |
|
1559 | 1558 | def __unicode__(self): |
|
1560 | 1559 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id, |
|
1561 |
safe_ |
|
|
1560 | safe_str(self.repo_name)) | |
|
1562 | 1561 | |
|
1563 | 1562 | @hybrid_property |
|
1564 | 1563 | def description_safe(self): |
@@ -1764,7 +1763,7 b' class Repository(Base, BaseModel):' | |||
|
1764 | 1763 | # names in the database, but that eventually needs to be converted |
|
1765 | 1764 | # into a valid system path |
|
1766 | 1765 | p += self.repo_name.split(self.NAME_SEP) |
|
1767 |
return os.path.join(*map(safe_ |
|
|
1766 | return os.path.join(*map(safe_str, p)) | |
|
1768 | 1767 | |
|
1769 | 1768 | @property |
|
1770 | 1769 | def cache_keys(self): |
@@ -3048,9 +3047,9 b' class CacheKey(Base, BaseModel):' | |||
|
3048 | 3047 | instance_id from .ini file. |
|
3049 | 3048 | """ |
|
3050 | 3049 | import rhodecode |
|
3051 |
prefix = safe_ |
|
|
3052 | ||
|
3053 |
repo_as_unicode = safe_ |
|
|
3050 | prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '') | |
|
3051 | ||
|
3052 | repo_as_unicode = safe_str(repo_name) | |
|
3054 | 3053 | key = u'{}_{}'.format(repo_as_unicode, cache_type) \ |
|
3055 | 3054 | if cache_type else repo_as_unicode |
|
3056 | 3055 | |
@@ -3426,7 +3425,7 b' class _PullRequestBase(BaseModel):' | |||
|
3426 | 3425 | merge_status = PullRequestModel().merge_status(pull_request) |
|
3427 | 3426 | merge_state = { |
|
3428 | 3427 | 'status': merge_status[0], |
|
3429 |
'message': safe_ |
|
|
3428 | 'message': safe_str(merge_status[1]), | |
|
3430 | 3429 | } |
|
3431 | 3430 | else: |
|
3432 | 3431 | merge_state = {'status': 'not_available', |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -40,8 +39,8 b' def create_default_object_permission(_SE' | |||
|
40 | 39 | def _get_group(perm_name): |
|
41 | 40 | return '.'.join(perm_name.split('.')[:1]) |
|
42 | 41 | |
|
43 | defined_perms_groups = map( | |
|
44 | _get_group, (x.permission.permission_name for x in obj_perms)) | |
|
42 | defined_perms_groups = list(map( | |
|
43 | _get_group, (x.permission.permission_name for x in obj_perms))) | |
|
45 | 44 | log.debug('GOT ALREADY DEFINED:%s', obj_perms) |
|
46 | 45 | |
|
47 | 46 | # for every default permission that needs to be created, we check if |
@@ -1,4 +1,4 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
1 | ||
|
2 | 2 | |
|
3 | 3 | import logging |
|
4 | 4 | from collections import namedtuple |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -26,7 +25,6 b' from sqlalchemy import *' | |||
|
26 | 25 | from sqlalchemy.exc import DatabaseError |
|
27 | 26 | from sqlalchemy.orm import relation, backref, class_mapper, joinedload |
|
28 | 27 | from sqlalchemy.ext.declarative import declarative_base |
|
29 | from sqlalchemy.orm import scoped_session, sessionmaker | |
|
30 | 28 | from rhodecode.lib.dbmigrate.migrate import * |
|
31 | 29 | from rhodecode.lib.dbmigrate.migrate.changeset import * |
|
32 | 30 |
General Comments 0
You need to be logged in to leave comments.
Login now