dbmigrate: python3 changes

- removed utf8 marker
- syntax fixes
This commit is contained in:
RhodeCode Admin 2023-07-18 09:40:40 +02:00
parent 6db5a493b6
commit c86b6915f1
86 changed files with 420 additions and 472 deletions

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2020 RhodeCode GmbH
#

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from sqlalchemy.util import OrderedDict

View file

@ -68,7 +68,7 @@ class ModelGenerator(object):
# crs: not sure if this is good idea, but it gets rid of extra
# u''
name = col.name.encode('utf8')
name = col.name#.encode('utf8')
type_ = col.type
for cls in col.type.__class__.__mro__:

View file

@ -4,8 +4,7 @@
import sys
import logging
from sqlalchemy import (Table, Column, MetaData, String, Text, Integer,
create_engine)
from sqlalchemy import (Table, Column, MetaData, String, Text, Integer, create_engine)
from sqlalchemy.sql import and_
from sqlalchemy import exc as sa_exceptions
from sqlalchemy.sql import bindparam
@ -153,7 +152,7 @@ class ControlledSchema(object):
if version is None:
version = 0
try:
version = VerNum(version) # raises valueerror
version = VerNum(version) # raises valueerror
if version < 0 or version > repository.latest:
raise ValueError()
except ValueError:

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rhodecode.lib.dbmigrate.migrate.versioning.script.base import BaseScript
from rhodecode.lib.dbmigrate.migrate.versioning.script.py import PythonScript

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from rhodecode.lib.dbmigrate.migrate import exceptions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import shutil
import warnings

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import shutil

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The migrate command-line tool."""

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""".. currentmodule:: migrate.versioning.util"""
import warnings
@ -125,8 +125,8 @@ def construct_engine(engine, **opts):
# DEPRECATED: handle echo the old way
echo = asbool(opts.get('echo', False))
if echo:
warnings.warn('echo=True parameter is deprecated, pass '
'engine_arg_echo=True or engine_dict={"echo": True}',
warnings.warn(
'echo=True parameter is deprecated, pass engine_arg_echo=True or engine_dict={"echo": True}',
exceptions.MigrateDeprecationWarning)
kwargs['echo'] = echo

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class KeyedInstance(object):
"""A class whose instances have a unique identifier of some sort

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -34,7 +33,7 @@ from rhodecode.lib.vcs.utils.helpers import get_scm
from rhodecode.lib.vcs.exceptions import VCSError
from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.auth import generate_auth_token
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, safe_unicode
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe
from rhodecode.lib.exceptions import UserGroupAssignedException
from rhodecode.lib.ext_json import json
@ -147,7 +146,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -164,7 +163,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __repr__(self):
return "<%s('%s:%s')>" % (self.__class__.__name__,

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -34,8 +33,7 @@ from rhodecode.lib.vcs.utils.helpers import get_scm
from rhodecode.lib.vcs.exceptions import VCSError
from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -165,7 +163,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -182,7 +180,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -40,8 +39,7 @@ from rhodecode.lib.vcs.utils.helpers import get_scm
from rhodecode.lib.vcs.exceptions import VCSError
from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_suffix
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, remove_suffix
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -173,7 +171,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -41,8 +40,7 @@ from rhodecode.lib.vcs.utils.helpers import get_scm
from rhodecode.lib.vcs.exceptions import VCSError
from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_suffix, remove_prefix
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, remove_suffix, remove_prefix
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -162,7 +160,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -183,7 +181,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -41,8 +40,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_suffix, remove_prefix
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, remove_suffix, remove_prefix
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -162,7 +160,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -183,7 +181,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (
@ -527,7 +525,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -42,7 +41,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_suffix, remove_prefix, time_to_datetime
remove_suffix, remove_prefix, time_to_datetime
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -162,7 +161,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -183,7 +182,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (
@ -557,7 +556,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
#NOTE for this migration we are required tio have it
@hybrid_property

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -42,7 +41,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_suffix, remove_prefix, time_to_datetime
remove_suffix, remove_prefix, time_to_datetime
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -162,7 +161,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -183,7 +182,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (
@ -582,7 +581,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -42,7 +41,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_suffix, remove_prefix, time_to_datetime
remove_suffix, remove_prefix, time_to_datetime
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -164,7 +163,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -185,7 +184,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
def __unicode__(self):
return u"<%s('%s:%s')>" % (
@ -584,7 +583,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int
remove_prefix, time_to_datetime, aslist, Optional, safe_int
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -150,7 +149,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -172,7 +171,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -189,7 +188,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -607,7 +606,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int
remove_prefix, time_to_datetime, aslist, Optional, safe_int
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -153,7 +152,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -175,7 +174,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -192,7 +191,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -606,7 +605,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int
remove_prefix, time_to_datetime, aslist, Optional, safe_int
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -153,7 +152,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -175,7 +174,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -192,7 +191,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -624,7 +623,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int
remove_prefix, time_to_datetime, aslist, Optional, safe_int
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -160,7 +159,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -195,7 +194,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -641,7 +640,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
get_clone_url
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -161,7 +160,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -179,7 +178,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -196,7 +195,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -657,7 +656,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
get_clone_url
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -161,7 +160,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -179,7 +178,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -196,7 +195,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -660,7 +659,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
get_clone_url
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -161,7 +160,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -179,7 +178,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -196,7 +195,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -664,7 +663,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -43,7 +42,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import str2bool, safe_str, get_commit_safe, \
safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
get_clone_url
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -161,7 +160,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -179,7 +178,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -196,7 +195,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -664,7 +663,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -46,7 +45,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -164,7 +163,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -183,7 +182,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -200,7 +199,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -692,7 +691,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -48,7 +47,7 @@ from zope.cachedescriptors.property import Lazy as LazyProperty
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -166,7 +165,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -185,7 +184,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -202,7 +201,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -702,7 +701,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -48,7 +47,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -210,7 +209,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -229,7 +228,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -246,7 +245,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -743,7 +742,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -48,7 +47,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -210,7 +209,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -229,7 +228,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -246,7 +245,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -743,7 +742,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -49,7 +48,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -211,7 +210,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -230,7 +229,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -247,7 +246,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -744,7 +743,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -49,7 +48,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -211,7 +210,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -230,7 +229,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -247,7 +246,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -744,7 +743,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -50,7 +49,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -212,7 +211,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -231,7 +230,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -248,7 +247,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -750,7 +749,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -50,7 +49,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -212,7 +211,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -231,7 +230,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -248,7 +247,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -315,7 +314,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -346,7 +345,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -364,7 +363,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -872,7 +871,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -50,7 +49,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -234,7 +233,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -253,7 +252,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -270,7 +269,7 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -337,7 +336,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -368,7 +367,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -386,7 +385,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -897,7 +896,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@classmethod
def get_by_repo_name(cls, repo_name):

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -55,7 +54,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, md5_safe,
str2bool, safe_str, get_commit_safe, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -308,7 +307,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -327,7 +326,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -339,7 +338,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -352,11 +351,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -455,7 +454,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -473,7 +472,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1182,7 +1181,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1621,7 +1620,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1827,7 +1826,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -3113,9 +3112,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3491,7 +3490,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -55,7 +54,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, md5_safe,
str2bool, safe_str, get_commit_safe, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -308,7 +307,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -327,7 +326,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -339,7 +338,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -352,11 +351,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -455,7 +454,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -473,7 +472,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1186,7 +1185,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1641,7 +1640,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1846,7 +1845,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -3196,9 +3195,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3574,7 +3573,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -54,7 +53,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -314,7 +313,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -333,7 +332,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -345,7 +344,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -358,11 +357,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -465,7 +464,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -483,7 +482,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1195,7 +1194,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1657,7 +1656,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1866,7 +1865,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2377,7 +2376,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -3598,7 +3597,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -3612,7 +3611,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -3724,7 +3723,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -54,7 +53,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -314,7 +313,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -333,7 +332,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -345,7 +344,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -358,11 +357,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -465,7 +464,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -483,7 +482,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1197,7 +1196,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1670,7 +1669,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1879,7 +1878,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2400,7 +2399,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -3657,7 +3656,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -3671,7 +3670,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -3783,7 +3782,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -54,7 +53,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -314,7 +313,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -333,7 +332,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -345,7 +344,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -358,11 +357,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -465,7 +464,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -483,7 +482,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1197,7 +1196,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1670,7 +1669,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1879,7 +1878,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2400,7 +2399,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -3658,7 +3657,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -3672,7 +3671,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -3784,7 +3783,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -57,7 +56,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -321,7 +320,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -340,7 +339,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -352,7 +351,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -365,11 +364,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -481,7 +480,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -499,7 +498,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1214,7 +1213,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1688,7 +1687,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1903,7 +1902,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2460,7 +2459,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -3904,7 +3903,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -3918,7 +3917,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -4030,7 +4029,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',
@ -5234,7 +5233,7 @@ class FileStoreMetadata(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -5300,7 +5299,7 @@ class FileStoreMetadata(Base, BaseModel):
# decode the encrypted value if it's encrypted field type
if '.encrypted' in self._file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_result_value(val, None))
val = safe_str(cipher.process_result_value(val, None))
# do final type conversion
converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode']
val = converter(val)
@ -5309,11 +5308,11 @@ class FileStoreMetadata(Base, BaseModel):
@file_store_meta_value.setter
def file_store_meta_value(self, val):
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if '.encrypted' in self.file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._file_store_meta_value = val
@hybrid_property

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -57,7 +56,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance, VCSError
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -321,7 +320,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -340,7 +339,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -352,7 +351,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -365,11 +364,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -481,7 +480,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -499,7 +498,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1267,7 +1266,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1742,7 +1741,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1961,7 +1960,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2545,7 +2544,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -3992,7 +3991,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -4006,7 +4005,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -4131,7 +4130,7 @@ class _PullRequestBase(BaseModel):
PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status,
'message': safe_unicode(msg),
'message': safe_str(msg),
}
else:
merge_state = {'status': 'not_available',
@ -5403,7 +5402,7 @@ class FileStoreMetadata(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -5469,7 +5468,7 @@ class FileStoreMetadata(Base, BaseModel):
# decode the encrypted value if it's encrypted field type
if '.encrypted' in self._file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_result_value(val, None))
val = safe_str(cipher.process_result_value(val, None))
# do final type conversion
converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode']
val = converter(val)
@ -5478,11 +5477,11 @@ class FileStoreMetadata(Base, BaseModel):
@file_store_meta_value.setter
def file_store_meta_value(self, val):
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if '.encrypted' in self.file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._file_store_meta_value = val
@hybrid_property

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -57,7 +56,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance, VCSError
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -321,7 +320,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -340,7 +339,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -352,7 +351,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -365,11 +364,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -481,7 +480,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -499,7 +498,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1273,7 +1272,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1748,7 +1747,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1967,7 +1966,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2551,7 +2550,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -4041,7 +4040,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -4055,7 +4054,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -4180,7 +4179,7 @@ class _PullRequestBase(BaseModel):
PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status,
'message': safe_unicode(msg),
'message': safe_str(msg),
}
else:
merge_state = {'status': 'not_available',
@ -5481,7 +5480,7 @@ class FileStoreMetadata(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -5547,7 +5546,7 @@ class FileStoreMetadata(Base, BaseModel):
# decode the encrypted value if it's encrypted field type
if '.encrypted' in self._file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_result_value(val, None))
val = safe_str(cipher.process_result_value(val, None))
# do final type conversion
converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode']
val = converter(val)
@ -5556,11 +5555,11 @@ class FileStoreMetadata(Base, BaseModel):
@file_store_meta_value.setter
def file_store_meta_value(self, val):
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if '.encrypted' in self.file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._file_store_meta_value = val
@hybrid_property

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -57,7 +56,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance, VCSError
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, sha1_safe,
str2bool, safe_str, get_commit_safe, sha1_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri, datetime_to_time)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, \
@ -326,7 +325,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -345,7 +344,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -357,7 +356,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -370,11 +369,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -486,7 +485,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -504,7 +503,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1296,7 +1295,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1771,7 +1770,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1998,7 +1997,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2582,7 +2581,7 @@ class Repository(Base, BaseModel):
def _get_instance_cached(self):
from rhodecode.lib import rc_cache
cache_namespace_uid = 'cache_repo_instance.{}'.format(self.repo_id)
cache_namespace_uid = f'repo_instance.{self.repo_id}'
invalidation_namespace = CacheKey.REPO_INVALIDATION_NAMESPACE.format(
repo_id=self.repo_id)
region = rc_cache.get_or_create_region('cache_repo_longterm', cache_namespace_uid)
@ -4086,7 +4085,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._source_ref = safe_unicode(val)
self._source_ref = safe_str(val)
_target_ref = Column('other_ref', Unicode(255), nullable=False)
@ -4100,7 +4099,7 @@ class _PullRequestBase(BaseModel):
if len(parts) != 3:
raise ValueError(
'Invalid reference format given: {}, expected X:Y:Z'.format(val))
self._target_ref = safe_unicode(val)
self._target_ref = safe_str(val)
@declared_attr
def target_repo_id(cls):
@ -4242,7 +4241,7 @@ class _PullRequestBase(BaseModel):
PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status,
'message': safe_unicode(msg),
'message': safe_str(msg),
}
else:
merge_state = {'status': 'not_available',
@ -5545,7 +5544,7 @@ class FileStoreMetadata(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -5611,7 +5610,7 @@ class FileStoreMetadata(Base, BaseModel):
# decode the encrypted value if it's encrypted field type
if '.encrypted' in self._file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_result_value(val, None))
val = safe_str(cipher.process_result_value(val, None))
# do final type conversion
converter = self.SETTINGS_TYPES.get(_type) or self.SETTINGS_TYPES['unicode']
val = converter(val)
@ -5620,11 +5619,11 @@ class FileStoreMetadata(Base, BaseModel):
@file_store_meta_value.setter
def file_store_meta_value(self, val):
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if '.encrypted' in self.file_store_meta_value_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._file_store_meta_value = val
@hybrid_property

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -55,7 +54,7 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
@ -269,7 +268,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -288,7 +287,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -300,7 +299,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -313,11 +312,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -414,7 +413,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -432,7 +431,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1333,7 +1332,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1534,7 +1533,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2797,9 +2796,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3087,7 +3086,7 @@ class PullRequest(Base, _PullRequestBase):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -55,9 +54,9 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.jsonalchemy import MutationObj, JsonType, JSONDict
from rhodecode.lib.jsonalchemy import MutationObj, JsonType
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
from rhodecode.lib.encrypt import AESCipher
@ -270,7 +269,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -289,7 +288,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -301,7 +300,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -314,11 +313,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -415,7 +414,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -433,7 +432,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1336,7 +1335,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1537,7 +1536,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2789,9 +2788,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3079,7 +3078,7 @@ class PullRequest(Base, _PullRequestBase):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -54,9 +53,9 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
from rhodecode.lib.jsonalchemy import MutationObj, JsonType, JSONDict
from rhodecode.lib.jsonalchemy import MutationObj, JsonType
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
from rhodecode.lib.encrypt import AESCipher
@ -269,7 +268,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -288,7 +287,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -300,7 +299,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -313,11 +312,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -414,7 +413,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -432,7 +431,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1335,7 +1334,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1536,7 +1535,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2788,9 +2787,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3079,7 +3078,7 @@ class PullRequest(Base, _PullRequestBase):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -55,10 +54,10 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re)
from rhodecode.lib.jsonalchemy import MutationObj, JsonType, JSONDict
from rhodecode.lib.jsonalchemy import MutationObj, JsonType
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
from rhodecode.lib.encrypt import AESCipher
@ -271,7 +270,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -290,7 +289,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -302,7 +301,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -315,11 +314,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -416,7 +415,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -434,7 +433,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1337,7 +1336,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1538,7 +1537,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2792,9 +2791,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3082,7 +3081,7 @@ class PullRequest(Base, _PullRequestBase):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -55,10 +54,10 @@ from rhodecode.lib.vcs.exceptions import VCSError
from rhodecode.lib.vcs.backends.base import (
EmptyCommit, Reference, MergeFailureReason)
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
str2bool, safe_str, get_commit_safe, remove_prefix, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType, JSONDict
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType
from rhodecode.lib.ext_json import json
from rhodecode.lib.caching_query import FromCache
from rhodecode.lib.encrypt import AESCipher
@ -271,7 +270,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -290,7 +289,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -302,7 +301,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -315,11 +314,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -416,7 +415,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -434,7 +433,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1337,7 +1336,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1538,7 +1537,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2792,9 +2791,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3082,7 +3081,7 @@ class PullRequest(Base, _PullRequestBase):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -51,7 +50,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, md5_safe,
str2bool, safe_str, get_commit_safe, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType
@ -267,7 +266,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -286,7 +285,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -298,7 +297,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -311,11 +310,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -413,7 +412,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -431,7 +430,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1380,7 +1379,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1581,7 +1580,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2848,9 +2847,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3193,7 +3192,7 @@ class _PullRequestBase(BaseModel):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -51,7 +50,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, md5_safe,
str2bool, safe_str, get_commit_safe, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType
@ -267,7 +266,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -286,7 +285,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -298,7 +297,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -311,11 +310,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -413,7 +412,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -431,7 +430,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1381,7 +1380,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def landing_rev(self):
@ -1582,7 +1581,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -2849,9 +2848,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3194,7 +3193,7 @@ class _PullRequestBase(BaseModel):
'review_status': pull_request.calculated_review_status(),
'mergeable': {
'status': merge_status[0],
'message': unicode(merge_status[1]),
'message': str(merge_status[1]),
},
'source': {
'clone_url': pull_request.source_repo.clone_url(),

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -49,7 +48,7 @@ from rhodecode.translation import _
from rhodecode.lib.vcs import get_vcs_instance
from rhodecode.lib.vcs.backends.base import EmptyCommit, Reference
from rhodecode.lib.utils2 import (
str2bool, safe_str, get_commit_safe, safe_unicode, md5_safe,
str2bool, safe_str, get_commit_safe, md5_safe,
time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict,
glob2re, StrictAttributeDict, cleaned_uri)
from rhodecode.lib.jsonalchemy import MutationObj, MutationList, JsonType
@ -267,7 +266,7 @@ class RhodeCodeSetting(Base, BaseModel):
SETTINGS_TYPES = {
'str': safe_str,
'int': safe_int,
'unicode': safe_unicode,
'unicode': safe_str,
'bool': str2bool,
'list': functools.partial(aslist, sep=',')
}
@ -286,7 +285,7 @@ class RhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -298,7 +297,7 @@ class RhodeCodeSetting(Base, BaseModel):
# decode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
v = safe_unicode(cipher.process_result_value(v, None))
v = safe_str(cipher.process_result_value(v, None))
converter = self.SETTINGS_TYPES.get(_type) or \
self.SETTINGS_TYPES['unicode']
@ -311,11 +310,11 @@ class RhodeCodeSetting(Base, BaseModel):
:param val:
"""
val = safe_unicode(val)
val = safe_str(val)
# encode the encrypted value
if 'encrypted' in self.app_settings_type:
cipher = EncryptedTextValue()
val = safe_unicode(cipher.process_bind_param(val, None))
val = safe_str(cipher.process_bind_param(val, None))
self._app_settings_value = val
@hybrid_property
@ -414,7 +413,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
@validates('_app_settings_value')
def validate_settings_value(self, key, val):
assert type(val) == unicode
assert type(val) == str
return val
@hybrid_property
@ -432,7 +431,7 @@ class RepoRhodeCodeSetting(Base, BaseModel):
:param val:
"""
self._app_settings_value = safe_unicode(val)
self._app_settings_value = safe_str(val)
@hybrid_property
def app_settings_type(self):
@ -1129,7 +1128,7 @@ class UserIpMap(Base, BaseModel):
@classmethod
def _get_ip_range(cls, ip_addr):
net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False)
net = ipaddress.ip_network(safe_str(ip_addr), strict=False)
return [str(net.network_address), str(net.broadcast_address)]
def __json__(self):
@ -1558,7 +1557,7 @@ class Repository(Base, BaseModel):
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))
safe_str(self.repo_name))
@hybrid_property
def description_safe(self):
@ -1764,7 +1763,7 @@ class Repository(Base, BaseModel):
# names in the database, but that eventually needs to be converted
# into a valid system path
p += self.repo_name.split(self.NAME_SEP)
return os.path.join(*map(safe_unicode, p))
return os.path.join(*map(safe_str, p))
@property
def cache_keys(self):
@ -3048,9 +3047,9 @@ class CacheKey(Base, BaseModel):
instance_id from .ini file.
"""
import rhodecode
prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
prefix = safe_str(rhodecode.CONFIG.get('instance_id') or '')
repo_as_unicode = safe_unicode(repo_name)
repo_as_unicode = safe_str(repo_name)
key = u'{}_{}'.format(repo_as_unicode, cache_type) \
if cache_type else repo_as_unicode
@ -3426,7 +3425,7 @@ class _PullRequestBase(BaseModel):
merge_status = PullRequestModel().merge_status(pull_request)
merge_state = {
'status': merge_status[0],
'message': safe_unicode(merge_status[1]),
'message': safe_str(merge_status[1]),
}
else:
merge_state = {'status': 'not_available',

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -40,8 +39,8 @@ def create_default_object_permission(_SESSION, db):
def _get_group(perm_name):
return '.'.join(perm_name.split('.')[:1])
defined_perms_groups = map(
_get_group, (x.permission.permission_name for x in obj_perms))
defined_perms_groups = list(map(
_get_group, (x.permission.permission_name for x in obj_perms)))
log.debug('GOT ALREADY DEFINED:%s', obj_perms)
# for every default permission that needs to be created, we check if

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import hashlib
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
import sqlalchemy as sa

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from collections import namedtuple

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
import sqlalchemy as sa

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import *

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2020 RhodeCode GmbH
#
@ -26,7 +25,6 @@ from sqlalchemy import *
from sqlalchemy.exc import DatabaseError
from sqlalchemy.orm import relation, backref, class_mapper, joinedload
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from rhodecode.lib.dbmigrate.migrate import *
from rhodecode.lib.dbmigrate.migrate.changeset import *