py3: remove usage of basestring
dan -
r3425:d577b778 default
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -19,6 +19,7
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import logging
21 import logging
22 from pyramid import compat
22
23
23 from rhodecode.api import (
24 from rhodecode.api import (
24 jsonrpc_method, JSONRPCError, JSONRPCForbidden, JSONRPCValidationError)
25 jsonrpc_method, JSONRPCError, JSONRPCForbidden, JSONRPCValidationError)
@@ -241,7 +242,7
241 # generate temporary password if user is external
242 # generate temporary password if user is external
242 password = PasswordGenerator().gen_password(length=16)
243 password = PasswordGenerator().gen_password(length=16)
243 create_repo_group = Optional.extract(create_personal_repo_group)
244 create_repo_group = Optional.extract(create_personal_repo_group)
244 if isinstance(create_repo_group, basestring):
245 if isinstance(create_repo_group, compat.string_types):
245 create_repo_group = str2bool(create_repo_group)
246 create_repo_group = str2bool(create_repo_group)
246
247
247 username = Optional.extract(username)
248 username = Optional.extract(username)
@@ -22,6 +22,7
22 import logging
22 import logging
23 import operator
23 import operator
24
24
25 from pyramid import compat
25 from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPBadRequest
26 from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPBadRequest
26
27
27 from rhodecode.lib import helpers as h, diffs
28 from rhodecode.lib import helpers as h, diffs
@@ -395,7 +396,7
395 return draw, start, length
396 return draw, start, length
396
397
397 def _get_order_col(self, order_by, model):
398 def _get_order_col(self, order_by, model):
398 if isinstance(order_by, basestring):
399 if isinstance(order_by, compat.string_types):
399 try:
400 try:
400 return operator.attrgetter(order_by)(model)
401 return operator.attrgetter(order_by)(model)
401 except AttributeError:
402 except AttributeError:
@@ -17,10 +17,10
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20 import os
21 import logging
21 import logging
22 import os
23 import shlex
22 import shlex
23 from pyramid import compat
24
24
25 # Do not use `from rhodecode import events` here, it will be overridden by the
25 # Do not use `from rhodecode import events` here, it will be overridden by the
26 # events module in this package due to pythons import mechanism.
26 # events module in this package due to pythons import mechanism.
@@ -85,6 +85,6
85 """
85 """
86 Append the path separator if missing.
86 Append the path separator if missing.
87 """
87 """
88 if isinstance(path, basestring) and not path.endswith(os.path.sep):
88 if isinstance(path, compat.string_types) and not path.endswith(os.path.sep):
89 path += os.path.sep
89 path += os.path.sep
90 return path
90 return path
@@ -26,6 +26,7
26 import os
26 import os
27 import time
27 import time
28
28
29 from pyramid import compat
29 from pyramid_mailer.mailer import Mailer
30 from pyramid_mailer.mailer import Mailer
30 from pyramid_mailer.message import Message
31 from pyramid_mailer.message import Message
31
32
@@ -62,7 +63,7
62 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
63 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
63
64
64 if recipients:
65 if recipients:
65 if isinstance(recipients, basestring):
66 if isinstance(recipients, compat.string_types):
66 recipients = recipients.split(',')
67 recipients = recipients.split(',')
67 else:
68 else:
68 # if recipients are not defined we send to email_config + all admins
69 # if recipients are not defined we send to email_config + all admins
@@ -26,6 +26,7
26 from pygments.formatters.html import _get_ttype_class as pygment_token_class
26 from pygments.formatters.html import _get_ttype_class as pygment_token_class
27 from pygments.lexers.special import TextLexer, Token
27 from pygments.lexers.special import TextLexer, Token
28 from pygments.lexers import get_lexer_by_name
28 from pygments.lexers import get_lexer_by_name
29 from pyramid import compat
29
30
30 from rhodecode.lib.helpers import (
31 from rhodecode.lib.helpers import (
31 get_lexer_for_filenode, html_escape, get_custom_lexer)
32 get_lexer_for_filenode, html_escape, get_custom_lexer)
@@ -695,7 +696,7
695 filenode = None
696 filenode = None
696 filename = None
697 filename = None
697
698
698 if isinstance(input_file, basestring):
699 if isinstance(input_file, compat.string_types):
699 filename = input_file
700 filename = input_file
700 elif isinstance(input_file, FileNode):
701 elif isinstance(input_file, FileNode):
701 filenode = input_file
702 filenode = input_file
@@ -18,13 +18,15
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 from pyramid import compat
22
21
23
22 def strip_whitespace(value):
24 def strip_whitespace(value):
23 """
25 """
24 Removes leading/trailing whitespace, newlines, and tabs from the value.
26 Removes leading/trailing whitespace, newlines, and tabs from the value.
25 Implements the `colander.interface.Preparer` interface.
27 Implements the `colander.interface.Preparer` interface.
26 """
28 """
27 if isinstance(value, basestring):
29 if isinstance(value, compat.string_types):
28 return value.strip(' \t\n\r')
30 return value.strip(' \t\n\r')
29 else:
31 else:
30 return value
32 return value
@@ -9,6 +9,7
9
9
10 from sqlalchemy.schema import ForeignKeyConstraint
10 from sqlalchemy.schema import ForeignKeyConstraint
11 from sqlalchemy.schema import UniqueConstraint
11 from sqlalchemy.schema import UniqueConstraint
12 from pyramid import compat
12
13
13 from rhodecode.lib.dbmigrate.migrate.exceptions import *
14 from rhodecode.lib.dbmigrate.migrate.exceptions import *
14 from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_07, SQLA_08
15 from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_07, SQLA_08
@@ -229,7 +230,7
229 diffs = self.compare_1_column(*p, **kw)
230 diffs = self.compare_1_column(*p, **kw)
230 else:
231 else:
231 # Zero columns specified
232 # Zero columns specified
232 if not len(p) or not isinstance(p[0], basestring):
233 if not len(p) or not isinstance(p[0], compat.string_types):
233 raise ValueError("First argument must be column name")
234 raise ValueError("First argument must be column name")
234 diffs = self.compare_parameters(*p, **kw)
235 diffs = self.compare_parameters(*p, **kw)
235
236
@@ -338,7 +339,7
338 """Extracts data from p and modifies diffs"""
339 """Extracts data from p and modifies diffs"""
339 p = list(p)
340 p = list(p)
340 while len(p):
341 while len(p):
341 if isinstance(p[0], basestring):
342 if isinstance(p[0], compat.string_types):
342 k.setdefault('name', p.pop(0))
343 k.setdefault('name', p.pop(0))
343 elif isinstance(p[0], sqlalchemy.types.TypeEngine):
344 elif isinstance(p[0], sqlalchemy.types.TypeEngine):
344 k.setdefault('type', p.pop(0))
345 k.setdefault('type', p.pop(0))
@@ -376,7 +377,7
376 return getattr(self, '_table', None)
377 return getattr(self, '_table', None)
377
378
378 def _set_table(self, table):
379 def _set_table(self, table):
379 if isinstance(table, basestring):
380 if isinstance(table, compat.string_types):
380 if self.alter_metadata:
381 if self.alter_metadata:
381 if not self.meta:
382 if not self.meta:
382 raise ValueError("metadata must be specified for table"
383 raise ValueError("metadata must be specified for table"
@@ -593,7 +594,7
593 if isinstance(cons,(ForeignKeyConstraint,
594 if isinstance(cons,(ForeignKeyConstraint,
594 UniqueConstraint)):
595 UniqueConstraint)):
595 for col_name in cons.columns:
596 for col_name in cons.columns:
596 if not isinstance(col_name,basestring):
597 if not isinstance(col_name, compat.string_types):
597 col_name = col_name.name
598 col_name = col_name.name
598 if self.name==col_name:
599 if self.name==col_name:
599 to_drop.add(cons)
600 to_drop.add(cons)
@@ -628,7 +629,7
628 if (getattr(self, name[:-5]) and not obj):
629 if (getattr(self, name[:-5]) and not obj):
629 raise InvalidConstraintError("Column.create() accepts index_name,"
630 raise InvalidConstraintError("Column.create() accepts index_name,"
630 " primary_key_name and unique_name to generate constraints")
631 " primary_key_name and unique_name to generate constraints")
631 if not isinstance(obj, basestring) and obj is not None:
632 if not isinstance(obj, compat.string_types) and obj is not None:
632 raise InvalidConstraintError(
633 raise InvalidConstraintError(
633 "%s argument for column must be constraint name" % name)
634 "%s argument for column must be constraint name" % name)
634
635
@@ -9,6 +9,7
9 from sqlalchemy.sql import and_
9 from sqlalchemy.sql import and_
10 from sqlalchemy import exc as sa_exceptions
10 from sqlalchemy import exc as sa_exceptions
11 from sqlalchemy.sql import bindparam
11 from sqlalchemy.sql import bindparam
12 from pyramid import compat
12
13
13 from rhodecode.lib.dbmigrate.migrate import exceptions
14 from rhodecode.lib.dbmigrate.migrate import exceptions
14 from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_07
15 from rhodecode.lib.dbmigrate.migrate.changeset import SQLA_07
@@ -25,7 +26,7
25 """A database under version control"""
26 """A database under version control"""
26
27
27 def __init__(self, engine, repository):
28 def __init__(self, engine, repository):
28 if isinstance(repository, basestring):
29 if isinstance(repository, compat.string_types):
29 repository = Repository(repository)
30 repository = Repository(repository)
30 self.engine = engine
31 self.engine = engine
31 self.repository = repository
32 self.repository = repository
@@ -134,7 +135,7
134 """
135 """
135 # Confirm that the version # is valid: positive, integer,
136 # Confirm that the version # is valid: positive, integer,
136 # exists in repos
137 # exists in repos
137 if isinstance(repository, basestring):
138 if isinstance(repository, compat.string_types):
138 repository = Repository(repository)
139 repository = Repository(repository)
139 version = cls._validate_version(repository, version)
140 version = cls._validate_version(repository, version)
140 table = cls._create_table_version(engine, repository, version)
141 table = cls._create_table_version(engine, repository, version)
@@ -199,7 +200,7
199 """
200 """
200 Compare the current model against the current database.
201 Compare the current model against the current database.
201 """
202 """
202 if isinstance(repository, basestring):
203 if isinstance(repository, compat.string_types):
203 repository = Repository(repository)
204 repository = Repository(repository)
204 model = load_model(model)
205 model = load_model(model)
205
206
@@ -212,7 +213,7
212 """
213 """
213 Dump the current database as a Python model.
214 Dump the current database as a Python model.
214 """
215 """
215 if isinstance(repository, basestring):
216 if isinstance(repository, compat.string_types):
216 repository = Repository(repository)
217 repository = Repository(repository)
217
218
218 diff = schemadiff.getDiffOfModelAgainstDatabase(
219 diff = schemadiff.getDiffOfModelAgainstDatabase(
@@ -7,6 +7,7
7 import inspect
7 import inspect
8 from StringIO import StringIO
8 from StringIO import StringIO
9
9
10 from pyramid import compat
10 from rhodecode.lib.dbmigrate import migrate
11 from rhodecode.lib.dbmigrate import migrate
11 from rhodecode.lib.dbmigrate.migrate.versioning import genmodel, schemadiff
12 from rhodecode.lib.dbmigrate.migrate.versioning import genmodel, schemadiff
12 from rhodecode.lib.dbmigrate.migrate.versioning.config import operations
13 from rhodecode.lib.dbmigrate.migrate.versioning.config import operations
@@ -51,7 +52,7
51 :rtype: string
52 :rtype: string
52 """
53 """
53
54
54 if isinstance(repository, basestring):
55 if isinstance(repository, compat.string_types):
55 # oh dear, an import cycle!
56 # oh dear, an import cycle!
56 from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository
57 from rhodecode.lib.dbmigrate.migrate.versioning.repository import Repository
57 repository = Repository(repository)
58 repository = Repository(repository)
@@ -11,6 +11,7
11 from sqlalchemy.engine import Engine
11 from sqlalchemy.engine import Engine
12 from sqlalchemy.pool import StaticPool
12 from sqlalchemy.pool import StaticPool
13
13
14 from pyramid import compat
14 from rhodecode.lib.dbmigrate.migrate import exceptions
15 from rhodecode.lib.dbmigrate.migrate import exceptions
15 from rhodecode.lib.dbmigrate.migrate.versioning.util.keyedinstance import KeyedInstance
16 from rhodecode.lib.dbmigrate.migrate.versioning.util.keyedinstance import KeyedInstance
16 from rhodecode.lib.dbmigrate.migrate.versioning.util.importpath import import_path
17 from rhodecode.lib.dbmigrate.migrate.versioning.util.importpath import import_path
@@ -18,6 +19,7
18
19
19 log = logging.getLogger(__name__)
20 log = logging.getLogger(__name__)
20
21
22
21 def load_model(dotted_name):
23 def load_model(dotted_name):
22 """Import module and use module-level variable".
24 """Import module and use module-level variable".
23
25
@@ -26,7 +28,7
26 .. versionchanged:: 0.5.4
28 .. versionchanged:: 0.5.4
27
29
28 """
30 """
29 if isinstance(dotted_name, basestring):
31 if isinstance(dotted_name, compat.string_types):
30 if ':' not in dotted_name:
32 if ':' not in dotted_name:
31 # backwards compatibility
33 # backwards compatibility
32 warnings.warn('model should be in form of module.model:User '
34 warnings.warn('model should be in form of module.model:User '
@@ -39,7 +41,7
39
41
40 def asbool(obj):
42 def asbool(obj):
41 """Do everything to use object as bool"""
43 """Do everything to use object as bool"""
42 if isinstance(obj, basestring):
44 if isinstance(obj, compat.string_types):
43 obj = obj.strip().lower()
45 obj = obj.strip().lower()
44 if obj in ['true', 'yes', 'on', 'y', 't', '1']:
46 if obj in ['true', 'yes', 'on', 'y', 't', '1']:
45 return True
47 return True
@@ -112,7 +114,7
112 """
114 """
113 if isinstance(engine, Engine):
115 if isinstance(engine, Engine):
114 return engine
116 return engine
115 elif not isinstance(engine, basestring):
117 elif not isinstance(engine, compat.string_types):
116 raise ValueError("you need to pass either an existing engine or a database uri")
118 raise ValueError("you need to pass either an existing engine or a database uri")
117
119
118 # get options for create_engine
120 # get options for create_engine
@@ -28,6 +28,7
28 from sqlalchemy.ext.hybrid import hybrid_property
28 from sqlalchemy.ext.hybrid import hybrid_property
29 from sqlalchemy.orm import relationship, joinedload, class_mapper, validates
29 from sqlalchemy.orm import relationship, joinedload, class_mapper, validates
30 from beaker.cache import cache_region, region_invalidate
30 from beaker.cache import cache_region, region_invalidate
31 from pyramid import compat
31
32
32 from rhodecode.lib.vcs import get_backend
33 from rhodecode.lib.vcs import get_backend
33 from rhodecode.lib.vcs.utils.helpers import get_scm
34 from rhodecode.lib.vcs.utils.helpers import get_scm
@@ -413,7 +414,7
413 Session.flush()
414 Session.flush()
414 members_list = []
415 members_list = []
415 if v:
416 if v:
416 v = [v] if isinstance(v, basestring) else v
417 v = [v] if isinstance(v, compat.string_types) else v
417 for u_id in set(v):
418 for u_id in set(v):
418 member = UserGroupMember(users_group_id, u_id)
419 member = UserGroupMember(users_group_id, u_id)
419 members_list.append(member)
420 members_list.append(member)
@@ -49,7 +49,7
49 from sqlalchemy.dialects.mysql import LONGTEXT
49 from sqlalchemy.dialects.mysql import LONGTEXT
50 from beaker.cache import cache_region
50 from beaker.cache import cache_region
51 from zope.cachedescriptors.property import Lazy as LazyProperty
51 from zope.cachedescriptors.property import Lazy as LazyProperty
52
52 from pyramid import compat
53 from pyramid.threadlocal import get_current_request
53 from pyramid.threadlocal import get_current_request
54
54
55 from rhodecode.translation import _
55 from rhodecode.translation import _
@@ -2110,7 +2110,7
2110 warnings.warn("Use get_commit", DeprecationWarning)
2110 warnings.warn("Use get_commit", DeprecationWarning)
2111 commit_id = None
2111 commit_id = None
2112 commit_idx = None
2112 commit_idx = None
2113 if isinstance(rev, basestring):
2113 if isinstance(rev, compat.string_types):
2114 commit_id = rev
2114 commit_id = rev
2115 else:
2115 else:
2116 commit_idx = rev
2116 commit_idx = rev
@@ -3726,7 +3726,7
3726 @reasons.setter
3726 @reasons.setter
3727 def reasons(self, val):
3727 def reasons(self, val):
3728 val = val or []
3728 val = val or []
3729 if any(not isinstance(x, basestring) for x in val):
3729 if any(not isinstance(x, compat.string_types) for x in val):
3730 raise Exception('invalid reasons type, must be list of strings')
3730 raise Exception('invalid reasons type, must be list of strings')
3731 self._reasons = val
3731 self._reasons = val
3732
3732
@@ -49,7 +49,7
49 from sqlalchemy.dialects.mysql import LONGTEXT
49 from sqlalchemy.dialects.mysql import LONGTEXT
50 from beaker.cache import cache_region
50 from beaker.cache import cache_region
51 from zope.cachedescriptors.property import Lazy as LazyProperty
51 from zope.cachedescriptors.property import Lazy as LazyProperty
52
52 from pyramid import compat
53 from pyramid.threadlocal import get_current_request
53 from pyramid.threadlocal import get_current_request
54
54
55 from rhodecode.translation import _
55 from rhodecode.translation import _
@@ -2176,7 +2176,7
2176 warnings.warn("Use get_commit", DeprecationWarning)
2176 warnings.warn("Use get_commit", DeprecationWarning)
2177 commit_id = None
2177 commit_id = None
2178 commit_idx = None
2178 commit_idx = None
2179 if isinstance(rev, basestring):
2179 if isinstance(rev, compat.string_types):
2180 commit_id = rev
2180 commit_id = rev
2181 else:
2181 else:
2182 commit_idx = rev
2182 commit_idx = rev
@@ -3809,7 +3809,7
3809 @reasons.setter
3809 @reasons.setter
3810 def reasons(self, val):
3810 def reasons(self, val):
3811 val = val or []
3811 val = val or []
3812 if any(not isinstance(x, basestring) for x in val):
3812 if any(not isinstance(x, compat.string_types) for x in val):
3813 raise Exception('invalid reasons type, must be list of strings')
3813 raise Exception('invalid reasons type, must be list of strings')
3814 self._reasons = val
3814 self._reasons = val
3815
3815
@@ -48,7 +48,7
48 from sqlalchemy.exc import IntegrityError # pragma: no cover
48 from sqlalchemy.exc import IntegrityError # pragma: no cover
49 from sqlalchemy.dialects.mysql import LONGTEXT
49 from sqlalchemy.dialects.mysql import LONGTEXT
50 from zope.cachedescriptors.property import Lazy as LazyProperty
50 from zope.cachedescriptors.property import Lazy as LazyProperty
51
51 from pyramid import compat
52 from pyramid.threadlocal import get_current_request
52 from pyramid.threadlocal import get_current_request
53
53
54 from rhodecode.translation import _
54 from rhodecode.translation import _
@@ -2217,7 +2217,7
2217 warnings.warn("Use get_commit", DeprecationWarning)
2217 warnings.warn("Use get_commit", DeprecationWarning)
2218 commit_id = None
2218 commit_id = None
2219 commit_idx = None
2219 commit_idx = None
2220 if isinstance(rev, basestring):
2220 if isinstance(rev, compat.string_types):
2221 commit_id = rev
2221 commit_id = rev
2222 else:
2222 else:
2223 commit_idx = rev
2223 commit_idx = rev
@@ -3957,7 +3957,7
3957 @reasons.setter
3957 @reasons.setter
3958 def reasons(self, val):
3958 def reasons(self, val):
3959 val = val or []
3959 val = val or []
3960 if any(not isinstance(x, basestring) for x in val):
3960 if any(not isinstance(x, compat.string_types) for x in val):
3961 raise Exception('invalid reasons type, must be list of strings')
3961 raise Exception('invalid reasons type, must be list of strings')
3962 self._reasons = val
3962 self._reasons = val
3963
3963
@@ -48,7 +48,7
48 from sqlalchemy.exc import IntegrityError # pragma: no cover
48 from sqlalchemy.exc import IntegrityError # pragma: no cover
49 from sqlalchemy.dialects.mysql import LONGTEXT
49 from sqlalchemy.dialects.mysql import LONGTEXT
50 from zope.cachedescriptors.property import Lazy as LazyProperty
50 from zope.cachedescriptors.property import Lazy as LazyProperty
51
51 from pyramid import compat
52 from pyramid.threadlocal import get_current_request
52 from pyramid.threadlocal import get_current_request
53
53
54 from rhodecode.translation import _
54 from rhodecode.translation import _
@@ -2240,7 +2240,7
2240 warnings.warn("Use get_commit", DeprecationWarning)
2240 warnings.warn("Use get_commit", DeprecationWarning)
2241 commit_id = None
2241 commit_id = None
2242 commit_idx = None
2242 commit_idx = None
2243 if isinstance(rev, basestring):
2243 if isinstance(rev, compat.string_types):
2244 commit_id = rev
2244 commit_id = rev
2245 else:
2245 else:
2246 commit_idx = rev
2246 commit_idx = rev
@@ -4031,7 +4031,7
4031 @reasons.setter
4031 @reasons.setter
4032 def reasons(self, val):
4032 def reasons(self, val):
4033 val = val or []
4033 val = val or []
4034 if any(not isinstance(x, basestring) for x in val):
4034 if any(not isinstance(x, compat.string_types) for x in val):
4035 raise Exception('invalid reasons type, must be list of strings')
4035 raise Exception('invalid reasons type, must be list of strings')
4036 self._reasons = val
4036 self._reasons = val
4037
4037
@@ -34,7 +34,6
34 import traceback
34 import traceback
35 import collections
35 import collections
36
36
37
38 from sqlalchemy import *
37 from sqlalchemy import *
39 from sqlalchemy.exc import IntegrityError
38 from sqlalchemy.exc import IntegrityError
40 from sqlalchemy.ext.declarative import declared_attr
39 from sqlalchemy.ext.declarative import declared_attr
@@ -45,6 +44,7
45 from beaker.cache import cache_region, region_invalidate
44 from beaker.cache import cache_region, region_invalidate
46 from webob.exc import HTTPNotFound
45 from webob.exc import HTTPNotFound
47 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from pyramid import compat
48
48
49 # replace pylons with fake url for migration
49 # replace pylons with fake url for migration
50 from rhodecode.lib.dbmigrate.schema import url
50 from rhodecode.lib.dbmigrate.schema import url
@@ -1811,7 +1811,7
1811 warnings.warn("Use get_commit", DeprecationWarning)
1811 warnings.warn("Use get_commit", DeprecationWarning)
1812 commit_id = None
1812 commit_id = None
1813 commit_idx = None
1813 commit_idx = None
1814 if isinstance(rev, basestring):
1814 if isinstance(rev, compat.string_types):
1815 commit_id = rev
1815 commit_id = rev
1816 else:
1816 else:
1817 commit_idx = rev
1817 commit_idx = rev
@@ -34,7 +34,6
34 import traceback
34 import traceback
35 import collections
35 import collections
36
36
37
38 from sqlalchemy import *
37 from sqlalchemy import *
39 from sqlalchemy.exc import IntegrityError
38 from sqlalchemy.exc import IntegrityError
40 from sqlalchemy.ext.declarative import declared_attr
39 from sqlalchemy.ext.declarative import declared_attr
@@ -45,6 +44,7
45 from beaker.cache import cache_region, region_invalidate
44 from beaker.cache import cache_region, region_invalidate
46 from webob.exc import HTTPNotFound
45 from webob.exc import HTTPNotFound
47 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from pyramid import compat
48
48
49 # replace pylons with fake url for migration
49 # replace pylons with fake url for migration
50 from rhodecode.lib.dbmigrate.schema import url
50 from rhodecode.lib.dbmigrate.schema import url
@@ -1814,7 +1814,7
1814 warnings.warn("Use get_commit", DeprecationWarning)
1814 warnings.warn("Use get_commit", DeprecationWarning)
1815 commit_id = None
1815 commit_id = None
1816 commit_idx = None
1816 commit_idx = None
1817 if isinstance(rev, basestring):
1817 if isinstance(rev, compat.string_types):
1818 commit_id = rev
1818 commit_id = rev
1819 else:
1819 else:
1820 commit_idx = rev
1820 commit_idx = rev
@@ -34,7 +34,6
34 import traceback
34 import traceback
35 import collections
35 import collections
36
36
37
38 from sqlalchemy import *
37 from sqlalchemy import *
39 from sqlalchemy.exc import IntegrityError
38 from sqlalchemy.exc import IntegrityError
40 from sqlalchemy.ext.declarative import declared_attr
39 from sqlalchemy.ext.declarative import declared_attr
@@ -45,7 +44,7
45 from beaker.cache import cache_region, region_invalidate
44 from beaker.cache import cache_region, region_invalidate
46 from webob.exc import HTTPNotFound
45 from webob.exc import HTTPNotFound
47 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from zope.cachedescriptors.property import Lazy as LazyProperty
48
47 from pyramid import compat
49 # replace pylons with fake url for migration
48 # replace pylons with fake url for migration
50 from rhodecode.lib.dbmigrate.schema import url
49 from rhodecode.lib.dbmigrate.schema import url
51 from rhodecode.translation import _
50 from rhodecode.translation import _
@@ -1814,7 +1813,7
1814 warnings.warn("Use get_commit", DeprecationWarning)
1813 warnings.warn("Use get_commit", DeprecationWarning)
1815 commit_id = None
1814 commit_id = None
1816 commit_idx = None
1815 commit_idx = None
1817 if isinstance(rev, basestring):
1816 if isinstance(rev, compat.string_types):
1818 commit_id = rev
1817 commit_id = rev
1819 else:
1818 else:
1820 commit_idx = rev
1819 commit_idx = rev
@@ -35,7 +35,6
35 import traceback
35 import traceback
36 import collections
36 import collections
37
37
38
39 from sqlalchemy import *
38 from sqlalchemy import *
40 from sqlalchemy.exc import IntegrityError
39 from sqlalchemy.exc import IntegrityError
41 from sqlalchemy.ext.declarative import declared_attr
40 from sqlalchemy.ext.declarative import declared_attr
@@ -46,7 +45,7
46 from beaker.cache import cache_region, region_invalidate
45 from beaker.cache import cache_region, region_invalidate
47 from webob.exc import HTTPNotFound
46 from webob.exc import HTTPNotFound
48 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from zope.cachedescriptors.property import Lazy as LazyProperty
49
48 from pyramid import compat
50 # replace pylons with fake url for migration
49 # replace pylons with fake url for migration
51 from rhodecode.lib.dbmigrate.schema import url
50 from rhodecode.lib.dbmigrate.schema import url
52 from rhodecode.translation import _
51 from rhodecode.translation import _
@@ -1816,7 +1815,7
1816 warnings.warn("Use get_commit", DeprecationWarning)
1815 warnings.warn("Use get_commit", DeprecationWarning)
1817 commit_id = None
1816 commit_id = None
1818 commit_idx = None
1817 commit_idx = None
1819 if isinstance(rev, basestring):
1818 if isinstance(rev, compat.string_types):
1820 commit_id = rev
1819 commit_id = rev
1821 else:
1820 else:
1822 commit_idx = rev
1821 commit_idx = rev
@@ -35,7 +35,6
35 import traceback
35 import traceback
36 import collections
36 import collections
37
37
38
39 from sqlalchemy import *
38 from sqlalchemy import *
40 from sqlalchemy.exc import IntegrityError
39 from sqlalchemy.exc import IntegrityError
41 from sqlalchemy.ext.declarative import declared_attr
40 from sqlalchemy.ext.declarative import declared_attr
@@ -46,7 +45,7
46 from beaker.cache import cache_region, region_invalidate
45 from beaker.cache import cache_region, region_invalidate
47 from webob.exc import HTTPNotFound
46 from webob.exc import HTTPNotFound
48 from zope.cachedescriptors.property import Lazy as LazyProperty
47 from zope.cachedescriptors.property import Lazy as LazyProperty
49
48 from pyramid import compat
50 # replace pylons with fake url for migration
49 # replace pylons with fake url for migration
51 from rhodecode.lib.dbmigrate.schema import url
50 from rhodecode.lib.dbmigrate.schema import url
52 from rhodecode.translation import _
51 from rhodecode.translation import _
@@ -1816,7 +1815,7
1816 warnings.warn("Use get_commit", DeprecationWarning)
1815 warnings.warn("Use get_commit", DeprecationWarning)
1817 commit_id = None
1816 commit_id = None
1818 commit_idx = None
1817 commit_idx = None
1819 if isinstance(rev, basestring):
1818 if isinstance(rev, compat.string_types):
1820 commit_id = rev
1819 commit_id = rev
1821 else:
1820 else:
1822 commit_idx = rev
1821 commit_idx = rev
@@ -3180,7 +3179,7
3180 @reasons.setter
3179 @reasons.setter
3181 def reasons(self, val):
3180 def reasons(self, val):
3182 val = val or []
3181 val = val or []
3183 if any(not isinstance(x, basestring) for x in val):
3182 if any(not isinstance(x, compat.string_types) for x in val):
3184 raise Exception('invalid reasons type, must be list of strings')
3183 raise Exception('invalid reasons type, must be list of strings')
3185 self._reasons = val
3184 self._reasons = val
3186
3185
@@ -34,7 +34,6
34 import traceback
34 import traceback
35 import collections
35 import collections
36
36
37
38 from sqlalchemy import *
37 from sqlalchemy import *
39 from sqlalchemy.ext.declarative import declared_attr
38 from sqlalchemy.ext.declarative import declared_attr
40 from sqlalchemy.ext.hybrid import hybrid_property
39 from sqlalchemy.ext.hybrid import hybrid_property
@@ -44,6 +43,7
44 from beaker.cache import cache_region
43 from beaker.cache import cache_region
45 from webob.exc import HTTPNotFound
44 from webob.exc import HTTPNotFound
46 from zope.cachedescriptors.property import Lazy as LazyProperty
45 from zope.cachedescriptors.property import Lazy as LazyProperty
46 from pyramid import compat
47
47
48 # replace pylons with fake url for migration
48 # replace pylons with fake url for migration
49 from rhodecode.lib.dbmigrate.schema import url
49 from rhodecode.lib.dbmigrate.schema import url
@@ -1858,7 +1858,7
1858 warnings.warn("Use get_commit", DeprecationWarning)
1858 warnings.warn("Use get_commit", DeprecationWarning)
1859 commit_id = None
1859 commit_id = None
1860 commit_idx = None
1860 commit_idx = None
1861 if isinstance(rev, basestring):
1861 if isinstance(rev, compat.string_types):
1862 commit_id = rev
1862 commit_id = rev
1863 else:
1863 else:
1864 commit_idx = rev
1864 commit_idx = rev
@@ -3407,7 +3407,7
3407 @reasons.setter
3407 @reasons.setter
3408 def reasons(self, val):
3408 def reasons(self, val):
3409 val = val or []
3409 val = val or []
3410 if any(not isinstance(x, basestring) for x in val):
3410 if any(not isinstance(x, compat.string_types) for x in val):
3411 raise Exception('invalid reasons type, must be list of strings')
3411 raise Exception('invalid reasons type, must be list of strings')
3412 self._reasons = val
3412 self._reasons = val
3413
3413
@@ -34,7 +34,6
34 import traceback
34 import traceback
35 import collections
35 import collections
36
36
37
38 from sqlalchemy import *
37 from sqlalchemy import *
39 from sqlalchemy.ext.declarative import declared_attr
38 from sqlalchemy.ext.declarative import declared_attr
40 from sqlalchemy.ext.hybrid import hybrid_property
39 from sqlalchemy.ext.hybrid import hybrid_property
@@ -44,6 +43,7
44 from beaker.cache import cache_region
43 from beaker.cache import cache_region
45 from webob.exc import HTTPNotFound
44 from webob.exc import HTTPNotFound