Show More
@@ -214,7 +214,7 b' def get_user_or_error(userid):' | |||
|
214 | 214 | from rhodecode.model.user import UserModel |
|
215 | 215 | user_model = UserModel() |
|
216 | 216 | |
|
217 |
if isinstance(userid, |
|
|
217 | if isinstance(userid, int): | |
|
218 | 218 | try: |
|
219 | 219 | user = user_model.get_user(userid) |
|
220 | 220 | except ValueError: |
@@ -237,7 +237,7 b' def get_repo_or_error(repoid):' | |||
|
237 | 237 | from rhodecode.model.repo import RepoModel |
|
238 | 238 | repo_model = RepoModel() |
|
239 | 239 | |
|
240 |
if isinstance(repoid, |
|
|
240 | if isinstance(repoid, int): | |
|
241 | 241 | try: |
|
242 | 242 | repo = repo_model.get_repo(repoid) |
|
243 | 243 | except ValueError: |
@@ -260,7 +260,7 b' def get_repo_group_or_error(repogroupid)' | |||
|
260 | 260 | from rhodecode.model.repo_group import RepoGroupModel |
|
261 | 261 | repo_group_model = RepoGroupModel() |
|
262 | 262 | |
|
263 |
if isinstance(repogroupid, |
|
|
263 | if isinstance(repogroupid, int): | |
|
264 | 264 | try: |
|
265 | 265 | repo_group = repo_group_model._get_repo_group(repogroupid) |
|
266 | 266 | except ValueError: |
@@ -283,7 +283,7 b' def get_user_group_or_error(usergroupid)' | |||
|
283 | 283 | from rhodecode.model.user_group import UserGroupModel |
|
284 | 284 | user_group_model = UserGroupModel() |
|
285 | 285 | |
|
286 |
if isinstance(usergroupid, |
|
|
286 | if isinstance(usergroupid, int): | |
|
287 | 287 | try: |
|
288 | 288 | user_group = user_group_model.get_group(usergroupid) |
|
289 | 289 | except ValueError: |
@@ -472,7 +472,7 b' class RhodeCodeAuthPluginBase(object):' | |||
|
472 | 472 | from rhodecode.authentication import plugin_default_auth_ttl |
|
473 | 473 | cache_ttl = plugin_default_auth_ttl |
|
474 | 474 | |
|
475 |
if isinstance(self.AUTH_CACHE_TTL, |
|
|
475 | if isinstance(self.AUTH_CACHE_TTL, int): | |
|
476 | 476 | # plugin cache set inside is more important than the settings value |
|
477 | 477 | cache_ttl = self.AUTH_CACHE_TTL |
|
478 | 478 | elif plugin_settings.get('cache_ttl'): |
@@ -47,7 +47,7 b' if PY3:' | |||
|
47 | 47 | MAXSIZE = sys.maxsize |
|
48 | 48 | else: |
|
49 | 49 | string_types = str, |
|
50 |
integer_types = |
|
|
50 | integer_types = int | |
|
51 | 51 | class_types = (type, types.ClassType) |
|
52 | 52 | text_type = unicode |
|
53 | 53 | binary_type = str |
@@ -1741,7 +1741,7 b' class Repository(Base, BaseModel):' | |||
|
1741 | 1741 | |
|
1742 | 1742 | @classmethod |
|
1743 | 1743 | def get_by_id_or_repo_name(cls, repoid): |
|
1744 |
if isinstance(repoid, |
|
|
1744 | if isinstance(repoid, int): | |
|
1745 | 1745 | try: |
|
1746 | 1746 | repo = cls.get(repoid) |
|
1747 | 1747 | except ValueError: |
@@ -1757,7 +1757,7 b' class Repository(Base, BaseModel):' | |||
|
1757 | 1757 | |
|
1758 | 1758 | @classmethod |
|
1759 | 1759 | def get_by_id_or_repo_name(cls, repoid): |
|
1760 |
if isinstance(repoid, |
|
|
1760 | if isinstance(repoid, int): | |
|
1761 | 1761 | try: |
|
1762 | 1762 | repo = cls.get(repoid) |
|
1763 | 1763 | except ValueError: |
@@ -1770,7 +1770,7 b' class Repository(Base, BaseModel):' | |||
|
1770 | 1770 | |
|
1771 | 1771 | @classmethod |
|
1772 | 1772 | def get_by_id_or_repo_name(cls, repoid): |
|
1773 |
if isinstance(repoid, |
|
|
1773 | if isinstance(repoid, int): | |
|
1774 | 1774 | try: |
|
1775 | 1775 | repo = cls.get(repoid) |
|
1776 | 1776 | except ValueError: |
@@ -1770,7 +1770,7 b' class Repository(Base, BaseModel):' | |||
|
1770 | 1770 | |
|
1771 | 1771 | @classmethod |
|
1772 | 1772 | def get_by_id_or_repo_name(cls, repoid): |
|
1773 |
if isinstance(repoid, |
|
|
1773 | if isinstance(repoid, int): | |
|
1774 | 1774 | try: |
|
1775 | 1775 | repo = cls.get(repoid) |
|
1776 | 1776 | except ValueError: |
@@ -1790,7 +1790,7 b' class Repository(Base, BaseModel):' | |||
|
1790 | 1790 | |
|
1791 | 1791 | @classmethod |
|
1792 | 1792 | def get_by_id_or_repo_name(cls, repoid): |
|
1793 |
if isinstance(repoid, |
|
|
1793 | if isinstance(repoid, int): | |
|
1794 | 1794 | try: |
|
1795 | 1795 | repo = cls.get(repoid) |
|
1796 | 1796 | except ValueError: |
@@ -1848,7 +1848,7 b' class Repository(Base, BaseModel):' | |||
|
1848 | 1848 | |
|
1849 | 1849 | @classmethod |
|
1850 | 1850 | def get_by_id_or_repo_name(cls, repoid): |
|
1851 |
if isinstance(repoid, |
|
|
1851 | if isinstance(repoid, int): | |
|
1852 | 1852 | try: |
|
1853 | 1853 | repo = cls.get(repoid) |
|
1854 | 1854 | except ValueError: |
@@ -1854,7 +1854,7 b' class Repository(Base, BaseModel):' | |||
|
1854 | 1854 | |
|
1855 | 1855 | @classmethod |
|
1856 | 1856 | def get_by_id_or_repo_name(cls, repoid): |
|
1857 |
if isinstance(repoid, |
|
|
1857 | if isinstance(repoid, int): | |
|
1858 | 1858 | try: |
|
1859 | 1859 | repo = cls.get(repoid) |
|
1860 | 1860 | except ValueError: |
@@ -1885,7 +1885,7 b' class Repository(Base, BaseModel):' | |||
|
1885 | 1885 | |
|
1886 | 1886 | @classmethod |
|
1887 | 1887 | def get_by_id_or_repo_name(cls, repoid): |
|
1888 |
if isinstance(repoid, |
|
|
1888 | if isinstance(repoid, int): | |
|
1889 | 1889 | try: |
|
1890 | 1890 | repo = cls.get(repoid) |
|
1891 | 1891 | except ValueError: |
@@ -28,7 +28,7 b' def _obj_dump(obj):' | |||
|
28 | 28 | return list(obj) |
|
29 | 29 | elif isinstance(obj, datetime.datetime): |
|
30 | 30 | r = obj.isoformat() |
|
31 |
if isinstance(obj.microsecond, |
|
|
31 | if isinstance(obj.microsecond, int): | |
|
32 | 32 | r = r[:23] + r[26:] |
|
33 | 33 | if r.endswith('+00:00'): |
|
34 | 34 | r = r[:-6] + 'Z' |
@@ -39,7 +39,7 b' def _obj_dump(obj):' | |||
|
39 | 39 | if is_aware(obj): |
|
40 | 40 | raise TypeError("Time-zone aware times are not JSON serializable") |
|
41 | 41 | r = obj.isoformat() |
|
42 |
if isinstance(obj.microsecond, |
|
|
42 | if isinstance(obj.microsecond, int): | |
|
43 | 43 | r = r[:12] |
|
44 | 44 | return r |
|
45 | 45 | elif hasattr(obj, '__json__'): |
@@ -788,7 +788,7 b' class BaseRepository(object):' | |||
|
788 | 788 | raise TypeError("commit_id must be a string value got {} instead".format(type(commit_id))) |
|
789 | 789 | |
|
790 | 790 | def _validate_commit_idx(self, commit_idx): |
|
791 |
if not isinstance(commit_idx, |
|
|
791 | if not isinstance(commit_idx, int): | |
|
792 | 792 | raise TypeError("commit_idx must be a numeric value") |
|
793 | 793 | |
|
794 | 794 | def _validate_branch_name(self, branch_name): |
@@ -76,7 +76,7 b' class BaseModel(object):' | |||
|
76 | 76 | |
|
77 | 77 | if isinstance(instance, cls): |
|
78 | 78 | return instance |
|
79 |
elif isinstance(instance, |
|
|
79 | elif isinstance(instance, int): | |
|
80 | 80 | if isinstance(cls, tuple): |
|
81 | 81 | # if we pass multi instances we pick first to .get() |
|
82 | 82 | cls = cls[0] |
@@ -523,7 +523,7 b' class CommentsModel(BaseModel):' | |||
|
523 | 523 | # would return 3 here |
|
524 | 524 | comment_version = ChangesetCommentHistory.get_version(comment_id) |
|
525 | 525 | |
|
526 |
if isinstance(version, |
|
|
526 | if isinstance(version, int) and (comment_version - version) != 1: | |
|
527 | 527 | log.warning( |
|
528 | 528 | 'Version mismatch comment_version {} submitted {}, skipping'.format( |
|
529 | 529 | comment_version-1, # -1 since note above |
@@ -46,11 +46,11 b' class IntegrationModel(BaseModel):' | |||
|
46 | 46 | def __get_integration(self, integration): |
|
47 | 47 | if isinstance(integration, Integration): |
|
48 | 48 | return integration |
|
49 |
elif isinstance(integration, |
|
|
49 | elif isinstance(integration, int): | |
|
50 | 50 | return self.sa.query(Integration).get(integration) |
|
51 | 51 | else: |
|
52 | 52 | if integration: |
|
53 |
raise Exception('integration must be int |
|
|
53 | raise Exception('integration must be int or Instance' | |
|
54 | 54 | ' of Integration got %s' % type(integration)) |
|
55 | 55 | |
|
56 | 56 | def create(self, IntegrationType, name, enabled, repo, repo_group, |
@@ -47,11 +47,11 b' class NotificationModel(BaseModel):' | |||
|
47 | 47 | def __get_notification(self, notification): |
|
48 | 48 | if isinstance(notification, Notification): |
|
49 | 49 | return notification |
|
50 |
elif isinstance(notification, |
|
|
50 | elif isinstance(notification, int): | |
|
51 | 51 | return Notification.get(notification) |
|
52 | 52 | else: |
|
53 | 53 | if notification: |
|
54 |
raise Exception('notification must be int |
|
|
54 | raise Exception('notification must be int or Instance' | |
|
55 | 55 | ' of Notification got %s' % type(notification)) |
|
56 | 56 | |
|
57 | 57 | def create( |
General Comments 0
You need to be logged in to leave comments.
Login now