Show More
@@ -19,6 +19,7 b'' | |||||
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 b' def create_user(request, apiuser, userna' | |||||
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, |
|
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 b' import time' | |||||
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 b' class DataGridAppView(object):' | |||||
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, |
|
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 b'' | |||||
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 b' def _append_path_sep(path):' | |||||
85 | """ |
|
85 | """ | |
86 | Append the path separator if missing. |
|
86 | Append the path separator if missing. | |
87 | """ |
|
87 | """ | |
88 |
if isinstance(path, |
|
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 b' by celery daemon' | |||||
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 b' def send_email(recipients, subject, body' | |||||
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, |
|
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 b' from pygments import lex' | |||||
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 b' class DiffSet(object):' | |||||
695 | filenode = None |
|
696 | filenode = None | |
696 | filename = None |
|
697 | filename = None | |
697 |
|
698 | |||
698 |
if isinstance(input_file, |
|
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 b'' | |||||
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, |
|
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 b' import sqlalchemy' | |||||
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 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
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], |
|
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 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
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], |
|
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 b' class ColumnDelta(DictMixin, sqlalchemy.' | |||||
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, |
|
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 b' populated with defaults' | |||||
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, |
|
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 b' populated with defaults' | |||||
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, |
|
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 b' from sqlalchemy import (Table, Column, M' | |||||
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 b' class ControlledSchema(object):' | |||||
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, |
|
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 b' class ControlledSchema(object):' | |||||
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, |
|
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 b' class ControlledSchema(object):' | |||||
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, |
|
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 b' class ControlledSchema(object):' | |||||
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, |
|
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 b' import logging' | |||||
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 b' class PythonScript(base.BaseScript):' | |||||
51 | :rtype: string |
|
52 | :rtype: string | |
52 | """ |
|
53 | """ | |
53 |
|
54 | |||
54 |
if isinstance(repository, |
|
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 b' from sqlalchemy import create_engine' | |||||
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 b' from rhodecode.lib.dbmigrate.migrate.ver' | |||||
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 b' def load_model(dotted_name):' | |||||
26 | .. versionchanged:: 0.5.4 |
|
28 | .. versionchanged:: 0.5.4 | |
27 |
|
29 | |||
28 | """ |
|
30 | """ | |
29 |
if isinstance(dotted_name, |
|
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 b' def load_model(dotted_name):' | |||||
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, |
|
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 b' def construct_engine(engine, **opts):' | |||||
112 | """ |
|
114 | """ | |
113 | if isinstance(engine, Engine): |
|
115 | if isinstance(engine, Engine): | |
114 | return engine |
|
116 | return engine | |
115 |
elif not isinstance(engine, |
|
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 b' from sqlalchemy import *' | |||||
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 b' class UserGroup(Base, BaseModel):' | |||||
413 | Session.flush() |
|
414 | Session.flush() | |
414 | members_list = [] |
|
415 | members_list = [] | |
415 | if v: |
|
416 | if v: | |
416 |
v = [v] if isinstance(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 b' from sqlalchemy.exc import IntegrityErro' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 b' from sqlalchemy.exc import IntegrityErro' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 b' from sqlalchemy.ext.hybrid import hybrid' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 b' from sqlalchemy.ext.hybrid import hybrid' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 b' import functools' | |||||
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 b' from sqlalchemy.sql.expression import tr' | |||||
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 | |
@@ -1859,7 +1859,7 b' class Repository(Base, BaseModel):' | |||||
1859 | warnings.warn("Use get_commit", DeprecationWarning) |
|
1859 | warnings.warn("Use get_commit", DeprecationWarning) | |
1860 | commit_id = None |
|
1860 | commit_id = None | |
1861 | commit_idx = None |
|
1861 | commit_idx = None | |
1862 |
if isinstance(rev, |
|
1862 | if isinstance(rev, compat.string_types): | |
1863 | commit_id = rev |
|
1863 | commit_id = rev | |
1864 | else: |
|
1864 | else: | |
1865 | commit_idx = rev |
|
1865 | commit_idx = rev | |
@@ -3408,7 +3408,7 b' class PullRequestReviewers(Base, BaseMod' | |||||
3408 | @reasons.setter |
|
3408 | @reasons.setter | |
3409 | def reasons(self, val): |
|
3409 | def reasons(self, val): | |
3410 | val = val or [] |
|
3410 | val = val or [] | |
3411 |
if any(not isinstance(x, |
|
3411 | if any(not isinstance(x, compat.string_types) for x in val): | |
3412 | raise Exception('invalid reasons type, must be list of strings') |
|
3412 | raise Exception('invalid reasons type, must be list of strings') | |
3413 | self._reasons = val |
|
3413 | self._reasons = val | |
3414 |
|
3414 |
@@ -34,7 +34,6 b' import functools' | |||||
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,7 +43,7 b' from sqlalchemy.sql.expression import tr' | |||||
44 | from sqlalchemy.sql.functions import coalesce, count # pragma: no cover |
|
43 | from sqlalchemy.sql.functions import coalesce, count # pragma: no cover | |
45 | from beaker.cache import cache_region |
|
44 | from beaker.cache import cache_region | |
46 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
45 | from zope.cachedescriptors.property import Lazy as LazyProperty | |
47 |
|
46 | from pyramid import compat | ||
48 | from pyramid.threadlocal import get_current_request |
|
47 | from pyramid.threadlocal import get_current_request | |
49 |
|
48 | |||
50 | from rhodecode.translation import _ |
|
49 | from rhodecode.translation import _ | |
@@ -2047,7 +2046,7 b' class Repository(Base, BaseModel):' | |||||
2047 | warnings.warn("Use get_commit", DeprecationWarning) |
|
2046 | warnings.warn("Use get_commit", DeprecationWarning) | |
2048 | commit_id = None |
|
2047 | commit_id = None | |
2049 | commit_idx = None |
|
2048 | commit_idx = None | |
2050 |
if isinstance(rev, |
|
2049 | if isinstance(rev, compat.string_types): | |
2051 | commit_id = rev |
|
2050 | commit_id = rev | |
2052 | else: |
|
2051 | else: | |
2053 | commit_idx = rev |
|
2052 | commit_idx = rev | |
@@ -3662,7 +3661,7 b' class PullRequestReviewers(Base, BaseMod' | |||||
3662 | @reasons.setter |
|
3661 | @reasons.setter | |
3663 | def reasons(self, val): |
|
3662 | def reasons(self, val): | |
3664 | val = val or [] |
|
3663 | val = val or [] | |
3665 |
if any(not isinstance(x, |
|
3664 | if any(not isinstance(x, compat.string_types) for x in val): | |
3666 | raise Exception('invalid reasons type, must be list of strings') |
|
3665 | raise Exception('invalid reasons type, must be list of strings') | |
3667 | self._reasons = val |
|
3666 | self._reasons = val | |
3668 |
|
3667 |
@@ -2,6 +2,7 b' import logging' | |||||
2 | import datetime |
|
2 | import datetime | |
3 |
|
3 | |||
4 | from sqlalchemy import * |
|
4 | from sqlalchemy import * | |
|
5 | from pyramid import compat | |||
5 |
|
6 | |||
6 | from rhodecode.lib.utils2 import safe_str |
|
7 | from rhodecode.lib.utils2 import safe_str | |
7 | from rhodecode.model import meta |
|
8 | from rhodecode.model import meta | |
@@ -12,7 +13,7 b' log = logging.getLogger(__name__)' | |||||
12 |
|
13 | |||
13 | def time_to_datetime(tm): |
|
14 | def time_to_datetime(tm): | |
14 | if tm: |
|
15 | if tm: | |
15 |
if isinstance(tm, |
|
16 | if isinstance(tm, compat.string_types): | |
16 | try: |
|
17 | try: | |
17 | tm = float(tm) |
|
18 | tm = float(tm) | |
18 | except ValueError: |
|
19 | except ValueError: |
@@ -1,4 +1,3 b'' | |||||
1 | #!/usr/bin/python2.4 |
|
|||
2 |
|
|
1 | ||
3 | from __future__ import division |
|
2 | from __future__ import division | |
4 |
|
3 | |||
@@ -33,6 +32,8 b' import re' | |||||
33 | import sys |
|
32 | import sys | |
34 | import time |
|
33 | import time | |
35 | import urllib |
|
34 | import urllib | |
|
35 | from pyramid import compat | |||
|
36 | ||||
36 |
|
37 | |||
37 | class diff_match_patch: |
|
38 | class diff_match_patch: | |
38 | """Class containing the diff, match and patch methods. |
|
39 | """Class containing the diff, match and patch methods. | |
@@ -1438,7 +1439,7 b' class diff_match_patch:' | |||||
1438 | text1 = None |
|
1439 | text1 = None | |
1439 | diffs = None |
|
1440 | diffs = None | |
1440 | # Note that texts may arrive as 'str' or 'unicode'. |
|
1441 | # Note that texts may arrive as 'str' or 'unicode'. | |
1441 |
if isinstance(a, |
|
1442 | if isinstance(a, compat.string_types) and isinstance(b, compat.string_types) and c is None: | |
1442 | # Method 1: text1, text2 |
|
1443 | # Method 1: text1, text2 | |
1443 | # Compute diffs from text1 and text2. |
|
1444 | # Compute diffs from text1 and text2. | |
1444 | text1 = a |
|
1445 | text1 = a | |
@@ -1451,11 +1452,11 b' class diff_match_patch:' | |||||
1451 | # Compute text1 from diffs. |
|
1452 | # Compute text1 from diffs. | |
1452 | diffs = a |
|
1453 | diffs = a | |
1453 | text1 = self.diff_text1(diffs) |
|
1454 | text1 = self.diff_text1(diffs) | |
1454 |
elif isinstance(a, |
|
1455 | elif isinstance(a, compat.string_types) and isinstance(b, list) and c is None: | |
1455 | # Method 3: text1, diffs |
|
1456 | # Method 3: text1, diffs | |
1456 | text1 = a |
|
1457 | text1 = a | |
1457 | diffs = b |
|
1458 | diffs = b | |
1458 |
elif (isinstance(a, |
|
1459 | elif (isinstance(a, compat.string_types) and isinstance(b, compat.string_types) and | |
1459 | isinstance(c, list)): |
|
1460 | isinstance(c, list)): | |
1460 | # Method 4: text1, text2, diffs |
|
1461 | # Method 4: text1, text2, diffs | |
1461 | # text2 is not used. |
|
1462 | # text2 is not used. |
@@ -34,7 +34,6 b' import urllib' | |||||
34 | import math |
|
34 | import math | |
35 | import logging |
|
35 | import logging | |
36 | import re |
|
36 | import re | |
37 | import urlparse |
|
|||
38 | import time |
|
37 | import time | |
39 | import string |
|
38 | import string | |
40 | import hashlib |
|
39 | import hashlib | |
@@ -45,6 +44,7 b' import itertools' | |||||
45 | import fnmatch |
|
44 | import fnmatch | |
46 | import bleach |
|
45 | import bleach | |
47 |
|
46 | |||
|
47 | from pyramid import compat | |||
48 | from datetime import datetime |
|
48 | from datetime import datetime | |
49 | from functools import partial |
|
49 | from functools import partial | |
50 | from pygments.formatters.html import HtmlFormatter |
|
50 | from pygments.formatters.html import HtmlFormatter |
@@ -120,7 +120,7 b' def get_default_cache_settings(settings,' | |||||
120 | if key.startswith(prefix): |
|
120 | if key.startswith(prefix): | |
121 | name = key.split(prefix)[1].strip() |
|
121 | name = key.split(prefix)[1].strip() | |
122 | val = settings[key] |
|
122 | val = settings[key] | |
123 |
if isinstance(val, |
|
123 | if isinstance(val, compat.string_types): | |
124 | val = val.strip() |
|
124 | val = val.strip() | |
125 | cache_settings[name] = val |
|
125 | cache_settings[name] = val | |
126 | return cache_settings |
|
126 | return cache_settings |
@@ -43,6 +43,7 b' import sqlalchemy.exc' | |||||
43 | import sqlalchemy.sql |
|
43 | import sqlalchemy.sql | |
44 | import webob |
|
44 | import webob | |
45 | import pyramid.threadlocal |
|
45 | import pyramid.threadlocal | |
|
46 | from pyramid import compat | |||
46 | from pyramid.settings import asbool |
|
47 | from pyramid.settings import asbool | |
47 |
|
48 | |||
48 | import rhodecode |
|
49 | import rhodecode | |
@@ -261,7 +262,7 b' def safe_str(unicode_, to_encoding=None)' | |||||
261 | """ |
|
262 | """ | |
262 |
|
263 | |||
263 | # if it's not basestr cast to str |
|
264 | # if it's not basestr cast to str | |
264 |
if not isinstance(unicode_, |
|
265 | if not isinstance(unicode_, compat.string_types): | |
265 | return str(unicode_) |
|
266 | return str(unicode_) | |
266 |
|
267 | |||
267 | if isinstance(unicode_, str): |
|
268 | if isinstance(unicode_, str): | |
@@ -687,7 +688,7 b' def datetime_to_time(dt):' | |||||
687 |
|
688 | |||
688 | def time_to_datetime(tm): |
|
689 | def time_to_datetime(tm): | |
689 | if tm: |
|
690 | if tm: | |
690 |
if isinstance(tm, |
|
691 | if isinstance(tm, compat.string_types): | |
691 | try: |
|
692 | try: | |
692 | tm = float(tm) |
|
693 | tm = float(tm) | |
693 | except ValueError: |
|
694 | except ValueError: | |
@@ -697,7 +698,7 b' def time_to_datetime(tm):' | |||||
697 |
|
698 | |||
698 | def time_to_utcdatetime(tm): |
|
699 | def time_to_utcdatetime(tm): | |
699 | if tm: |
|
700 | if tm: | |
700 |
if isinstance(tm, |
|
701 | if isinstance(tm, compat.string_types): | |
701 | try: |
|
702 | try: | |
702 | tm = float(tm) |
|
703 | tm = float(tm) | |
703 | except ValueError: |
|
704 | except ValueError: |
@@ -33,6 +33,7 b' import collections' | |||||
33 | import warnings |
|
33 | import warnings | |
34 |
|
34 | |||
35 | from zope.cachedescriptors.property import Lazy as LazyProperty |
|
35 | from zope.cachedescriptors.property import Lazy as LazyProperty | |
|
36 | from pyramid import compat | |||
36 |
|
37 | |||
37 | from rhodecode.translation import lazy_ugettext |
|
38 | from rhodecode.translation import lazy_ugettext | |
38 | from rhodecode.lib.utils2 import safe_str, safe_unicode |
|
39 | from rhodecode.lib.utils2 import safe_str, safe_unicode | |
@@ -692,7 +693,7 b' class BaseRepository(object):' | |||||
692 | (commit, self, commit.repository)) |
|
693 | (commit, self, commit.repository)) | |
693 |
|
694 | |||
694 | def _validate_commit_id(self, commit_id): |
|
695 | def _validate_commit_id(self, commit_id): | |
695 |
if not isinstance(commit_id, |
|
696 | if not isinstance(commit_id, compat.string_types): | |
696 | raise TypeError("commit_id must be a string value") |
|
697 | raise TypeError("commit_id must be a string value") | |
697 |
|
698 | |||
698 | def _validate_commit_idx(self, commit_idx): |
|
699 | def _validate_commit_idx(self, commit_idx): | |
@@ -729,7 +730,7 b' class BaseRepository(object):' | |||||
729 | warnings.warn("Use get_commit instead", DeprecationWarning) |
|
730 | warnings.warn("Use get_commit instead", DeprecationWarning) | |
730 | commit_id = None |
|
731 | commit_id = None | |
731 | commit_idx = None |
|
732 | commit_idx = None | |
732 |
if isinstance(revision, |
|
733 | if isinstance(revision, compat.string_types): | |
733 | commit_id = revision |
|
734 | commit_id = revision | |
734 | else: |
|
735 | else: | |
735 | commit_idx = revision |
|
736 | commit_idx = revision | |
@@ -756,7 +757,7 b' class BaseRepository(object):' | |||||
756 | if revision is None: |
|
757 | if revision is None: | |
757 | return revision |
|
758 | return revision | |
758 |
|
759 | |||
759 |
if isinstance(revision, |
|
760 | if isinstance(revision, compat.string_types): | |
760 | commit_id = revision |
|
761 | commit_id = revision | |
761 | else: |
|
762 | else: | |
762 | commit_id = self.commit_ids[revision] |
|
763 | commit_id = self.commit_ids[revision] |
@@ -25,6 +25,7 b' import logging' | |||||
25 | import functools |
|
25 | import functools | |
26 | import urllib2 |
|
26 | import urllib2 | |
27 | import rhodecode |
|
27 | import rhodecode | |
|
28 | from pyramid import compat | |||
28 |
|
29 | |||
29 | log = logging.getLogger(__name__) |
|
30 | log = logging.getLogger(__name__) | |
30 |
|
31 | |||
@@ -191,7 +192,7 b' def map_vcs_exceptions(func):' | |||||
191 | org_remote_tb = getattr(e, '_vcs_server_org_exc_tb', '') |
|
192 | org_remote_tb = getattr(e, '_vcs_server_org_exc_tb', '') | |
192 | __traceback_info__ = None |
|
193 | __traceback_info__ = None | |
193 | if remote_tb: |
|
194 | if remote_tb: | |
194 |
if isinstance(remote_tb, |
|
195 | if isinstance(remote_tb, compat.string_types): | |
195 | remote_tb = [remote_tb] |
|
196 | remote_tb = [remote_tb] | |
196 | __traceback_info__ = ( |
|
197 | __traceback_info__ = ( | |
197 | 'Found VCSServer remote traceback information:\n' |
|
198 | 'Found VCSServer remote traceback information:\n' |
@@ -48,7 +48,7 b' from sqlalchemy.ext.hybrid import hybrid' | |||||
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 b' class Repository(Base, BaseModel):' | |||||
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, |
|
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 b' class PullRequestReviewers(Base, BaseMod' | |||||
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, |
|
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 |
@@ -30,6 +30,7 b' import datetime' | |||||
30 | import urllib |
|
30 | import urllib | |
31 | import collections |
|
31 | import collections | |
32 |
|
32 | |||
|
33 | from pyramid import compat | |||
33 | from pyramid.threadlocal import get_current_request |
|
34 | from pyramid.threadlocal import get_current_request | |
34 |
|
35 | |||
35 | from rhodecode import events |
|
36 | from rhodecode import events | |
@@ -1001,7 +1002,7 b' class PullRequestModel(BaseModel):' | |||||
1001 |
|
1002 | |||
1002 | reviewers = {} |
|
1003 | reviewers = {} | |
1003 | for user_id, reasons, mandatory, rules in reviewer_data: |
|
1004 | for user_id, reasons, mandatory, rules in reviewer_data: | |
1004 |
if isinstance(user_id, (int, |
|
1005 | if isinstance(user_id, (int, compat.string_types)): | |
1005 | user_id = self._get_user(user_id).user_id |
|
1006 | user_id = self._get_user(user_id).user_id | |
1006 | reviewers[user_id] = { |
|
1007 | reviewers[user_id] = { | |
1007 | 'reasons': reasons, 'mandatory': mandatory} |
|
1008 | 'reasons': reasons, 'mandatory': mandatory} |
@@ -20,6 +20,7 b'' | |||||
20 |
|
20 | |||
21 | import logging |
|
21 | import logging | |
22 | import traceback |
|
22 | import traceback | |
|
23 | from pyramid import compat | |||
23 |
|
24 | |||
24 | from rhodecode.lib.utils2 import safe_str, safe_unicode |
|
25 | from rhodecode.lib.utils2 import safe_str, safe_unicode | |
25 | from rhodecode.lib.exceptions import ( |
|
26 | from rhodecode.lib.exceptions import ( | |
@@ -247,7 +248,7 b' class UserGroupModel(BaseModel):' | |||||
247 | # handle owner change |
|
248 | # handle owner change | |
248 | if 'user' in form_data: |
|
249 | if 'user' in form_data: | |
249 | owner = form_data['user'] |
|
250 | owner = form_data['user'] | |
250 |
if isinstance(owner, |
|
251 | if isinstance(owner, compat.string_types): | |
251 | owner = User.get_by_username(form_data['user']) |
|
252 | owner = User.get_by_username(form_data['user']) | |
252 |
|
253 | |||
253 | if not isinstance(owner, User): |
|
254 | if not isinstance(owner, User): |
@@ -19,6 +19,7 b'' | |||||
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 unicodedata |
|
21 | import unicodedata | |
|
22 | from pyramid import compat | |||
22 |
|
23 | |||
23 |
|
24 | |||
24 | def strip_preparer(value): |
|
25 | def strip_preparer(value): | |
@@ -83,6 +84,6 b' def unique_list_from_str_preparer(value)' | |||||
83 | """ |
|
84 | """ | |
84 | from rhodecode.lib.utils2 import aslist |
|
85 | from rhodecode.lib.utils2 import aslist | |
85 |
|
86 | |||
86 |
if isinstance(value, |
|
87 | if isinstance(value, compat.string_types): | |
87 | value = aslist(value, ',') |
|
88 | value = aslist(value, ',') | |
88 | return unique_list_preparer(value) No newline at end of file |
|
89 | return unique_list_preparer(value) |
@@ -21,6 +21,8 b'' | |||||
21 | import re |
|
21 | import re | |
22 |
|
22 | |||
23 | import colander |
|
23 | import colander | |
|
24 | from pyramid import compat | |||
|
25 | ||||
24 | from rhodecode.model.validation_schema import preparers |
|
26 | from rhodecode.model.validation_schema import preparers | |
25 | from rhodecode.model.db import User, UserGroup |
|
27 | from rhodecode.model.db import User, UserGroup | |
26 |
|
28 | |||
@@ -106,7 +108,7 b' class StringBooleanType(colander.String)' | |||||
106 | if isinstance(cstruct, bool): |
|
108 | if isinstance(cstruct, bool): | |
107 | return cstruct |
|
109 | return cstruct | |
108 |
|
110 | |||
109 |
if not isinstance(cstruct, |
|
111 | if not isinstance(cstruct, compat.string_types): | |
110 | raise colander.Invalid(node, '%r is not a string' % cstruct) |
|
112 | raise colander.Invalid(node, '%r is not a string' % cstruct) | |
111 |
|
113 | |||
112 | value = cstruct.lower() |
|
114 | value = cstruct.lower() | |
@@ -190,7 +192,7 b' class UserGroupType(UserOrUserGroupType)' | |||||
190 |
|
192 | |||
191 | class StrOrIntType(colander.String): |
|
193 | class StrOrIntType(colander.String): | |
192 | def deserialize(self, node, cstruct): |
|
194 | def deserialize(self, node, cstruct): | |
193 |
if isinstance(cstruct, |
|
195 | if isinstance(cstruct, compat.string_types): | |
194 | return super(StrOrIntType, self).deserialize(node, cstruct) |
|
196 | return super(StrOrIntType, self).deserialize(node, cstruct) | |
195 | else: |
|
197 | else: | |
196 | return colander.Integer().deserialize(node, cstruct) |
|
198 | return colander.Integer().deserialize(node, cstruct) |
@@ -37,6 +37,7 b' from formencode.validators import (' | |||||
37 |
|
37 | |||
38 | from sqlalchemy.sql.expression import true |
|
38 | from sqlalchemy.sql.expression import true | |
39 | from sqlalchemy.util import OrderedSet |
|
39 | from sqlalchemy.util import OrderedSet | |
|
40 | from pyramid import compat | |||
40 |
|
41 | |||
41 | from rhodecode.authentication import ( |
|
42 | from rhodecode.authentication import ( | |
42 | legacy_plugin_prefix, _import_legacy_plugin) |
|
43 | legacy_plugin_prefix, _import_legacy_plugin) | |
@@ -125,7 +126,7 b' def UniqueListFromString(localizer):' | |||||
125 |
|
126 | |||
126 | class _validator(UniqueList(localizer)): |
|
127 | class _validator(UniqueList(localizer)): | |
127 | def _to_python(self, value, state): |
|
128 | def _to_python(self, value, state): | |
128 |
if isinstance(value, |
|
129 | if isinstance(value, compat.string_types): | |
129 | value = aslist(value, ',') |
|
130 | value = aslist(value, ',') | |
130 | return super(_validator, self)._to_python(value, state) |
|
131 | return super(_validator, self)._to_python(value, state) | |
131 | return _validator |
|
132 | return _validator |
@@ -520,7 +520,7 b' def get_comments_for(diff_type, comments' | |||||
520 | if hasattr(filename, 'unicode_path'): |
|
520 | if hasattr(filename, 'unicode_path'): | |
521 | filename = filename.unicode_path |
|
521 | filename = filename.unicode_path | |
522 |
|
522 | |||
523 |
if not isinstance(filename, |
|
523 | if not isinstance(filename, (unicode, str)): | |
524 | return None |
|
524 | return None | |
525 |
|
525 | |||
526 | line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12 |
|
526 | line_key = '{}{}'.format(line_version, line_number) ## e.g o37, n12 |
@@ -19,6 +19,7 b'' | |||||
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 pytest |
|
21 | import pytest | |
|
22 | from pyramid import compat | |||
22 |
|
23 | |||
23 | from rhodecode.config.utils import set_instance_id |
|
24 | from rhodecode.config.utils import set_instance_id | |
24 |
|
25 | |||
@@ -31,6 +32,6 b' def test_set_instance_id(instance_id):' | |||||
31 | if instance_id == 'custom-id': |
|
32 | if instance_id == 'custom-id': | |
32 | assert config['instance_id'] == instance_id |
|
33 | assert config['instance_id'] == instance_id | |
33 | else: |
|
34 | else: | |
34 |
assert isinstance(config['instance_id'], |
|
35 | assert isinstance(config['instance_id'], compat.string_types) | |
35 | assert len(config['instance_id']) |
|
36 | assert len(config['instance_id']) | |
36 | assert instance_id != config['instance_id'] |
|
37 | assert instance_id != config['instance_id'] |
@@ -35,7 +35,7 b' import os' | |||||
35 | import sys |
|
35 | import sys | |
36 | from os.path import join as jn |
|
36 | from os.path import join as jn | |
37 | from os.path import dirname as dn |
|
37 | from os.path import dirname as dn | |
38 |
|
38 | from pyramid import compat | ||
39 | from sqlalchemy.util import OrderedSet |
|
39 | from sqlalchemy.util import OrderedSet | |
40 |
|
40 | |||
41 | __here__ = os.path.abspath(__file__) |
|
41 | __here__ = os.path.abspath(__file__) | |
@@ -77,7 +77,7 b' urllib2.install_opener(o)' | |||||
77 |
|
77 | |||
78 |
|
78 | |||
79 | def _get_repo(proj): |
|
79 | def _get_repo(proj): | |
80 |
if isinstance(proj, |
|
80 | if isinstance(proj, compat.string_types): | |
81 | repo = vcs.get_repo(jn(PROJECT_PATH, proj)) |
|
81 | repo = vcs.get_repo(jn(PROJECT_PATH, proj)) | |
82 | proj = proj |
|
82 | proj = proj | |
83 | else: |
|
83 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now