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