##// END OF EJS Templates
lint: use null() to compare to == None for linters to be happy
super-admin -
r5180:0f2a8907 default
parent child Browse files
Show More
@@ -35,7 +35,7 b' from rhodecode.lib import hooks_base'
35 35 from rhodecode.lib.utils2 import safe_int, str2bool, aslist
36 36 from rhodecode.lib.statsd_client import StatsdClient
37 37 from rhodecode.model.db import (
38 Session, IntegrityError, true, Repository, RepoGroup, User)
38 true, null, Session, IntegrityError, Repository, RepoGroup, User)
39 39 from rhodecode.model.permission import PermissionModel
40 40
41 41
@@ -393,7 +393,7 b' def sync_last_update_for_objects(*args, '
393 393 skip_groups = kwargs.get('skip_groups')
394 394 if not skip_groups:
395 395 repo_groups = RepoGroup.query() \
396 .filter(RepoGroup.group_parent_id == None)
396 .filter(RepoGroup.group_parent_id == null())
397 397
398 398 for root_gr in repo_groups:
399 399 for repo_gr in reversed(root_gr.recursive_groups()):
@@ -23,7 +23,7 b' import collections'
23 23
24 24 from rhodecode.model import BaseModel
25 25 from rhodecode.model.db import (
26 ChangesetStatus, ChangesetComment, PullRequest, PullRequestReviewers, Session)
26 null, ChangesetStatus, ChangesetComment, PullRequest, PullRequestReviewers, Session)
27 27 from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError
28 28 from rhodecode.lib.markup_renderer import (
29 29 DEFAULT_COMMENTS_RENDERER, RstTemplateRenderer)
@@ -60,7 +60,7 b' class ChangesetStatusModel(BaseModel):'
60 60 # the pull_request_version_id.
61 61 q = q.join(ChangesetComment).filter(
62 62 ChangesetStatus.pull_request == pull_request,
63 ChangesetComment.pull_request_version_id == None)
63 ChangesetComment.pull_request_version_id == null())
64 64 else:
65 65 raise Exception('Please specify revision or pull_request')
66 66 q = q.order_by(ChangesetStatus.version.asc())
@@ -151,7 +151,7 b' class CommentsModel(BaseModel):'
151 151 def get_repository_unresolved_todos(self, repo):
152 152 todos = Session().query(ChangesetComment) \
153 153 .filter(ChangesetComment.repo == repo) \
154 .filter(ChangesetComment.resolved_by == None) \
154 .filter(ChangesetComment.resolved_by == null()) \
155 155 .filter(ChangesetComment.comment_type
156 156 == ChangesetComment.COMMENT_TYPE_TODO)
157 157 todos = todos.all()
@@ -162,7 +162,7 b' class CommentsModel(BaseModel):'
162 162
163 163 todos = Session().query(ChangesetComment) \
164 164 .filter(ChangesetComment.pull_request == pull_request) \
165 .filter(ChangesetComment.resolved_by == None) \
165 .filter(ChangesetComment.resolved_by == null()) \
166 166 .filter(ChangesetComment.comment_type
167 167 == ChangesetComment.COMMENT_TYPE_TODO)
168 168
@@ -209,7 +209,7 b' class CommentsModel(BaseModel):'
209 209
210 210 todos = Session().query(ChangesetComment) \
211 211 .filter(ChangesetComment.revision == commit_id) \
212 .filter(ChangesetComment.resolved_by == None) \
212 .filter(ChangesetComment.resolved_by == null()) \
213 213 .filter(ChangesetComment.comment_type
214 214 == ChangesetComment.COMMENT_TYPE_TODO)
215 215
@@ -635,8 +635,8 b' class CommentsModel(BaseModel):'
635 635
636 636 q = ChangesetComment.query()\
637 637 .filter(ChangesetComment.repo_id == repo_id)\
638 .filter(ChangesetComment.line_no == None)\
639 .filter(ChangesetComment.f_path == None)
638 .filter(ChangesetComment.line_no == null())\
639 .filter(ChangesetComment.f_path == null())
640 640 if revision:
641 641 q = q.filter(ChangesetComment.revision == revision)
642 642 elif pull_request:
@@ -780,15 +780,15 b' class CommentsModel(BaseModel):'
780 780
781 781 def _all_inline_comments_of_pull_request(self, pull_request):
782 782 comments = Session().query(ChangesetComment)\
783 .filter(ChangesetComment.line_no != None)\
784 .filter(ChangesetComment.f_path != None)\
783 .filter(ChangesetComment.line_no != null())\
784 .filter(ChangesetComment.f_path != null())\
785 785 .filter(ChangesetComment.pull_request == pull_request)
786 786 return comments
787 787
788 788 def _all_general_comments_of_pull_request(self, pull_request):
789 789 comments = Session().query(ChangesetComment)\
790 .filter(ChangesetComment.line_no == None)\
791 .filter(ChangesetComment.f_path == None)\
790 .filter(ChangesetComment.line_no == null())\
791 .filter(ChangesetComment.f_path == null())\
792 792 .filter(ChangesetComment.pull_request == pull_request)
793 793
794 794 return comments
@@ -122,12 +122,12 b' class IntegrationModel(BaseModel):'
122 122 elif scope == 'global':
123 123 # global integrations
124 124 query = self.sa.query(Integration).filter(
125 and_(Integration.repo_id == None, Integration.repo_group_id == None)
125 and_(Integration.repo_id == null(), Integration.repo_group_id == null())
126 126 )
127 127 elif scope == 'root-repos':
128 128 query = self.sa.query(Integration).filter(
129 and_(Integration.repo_id == None,
130 Integration.repo_group_id == None,
129 and_(Integration.repo_id == null(),
130 Integration.repo_group_id == null(),
131 131 Integration.child_repos_only == true())
132 132 )
133 133 elif scope == 'all':
@@ -1316,7 +1316,7 b' class PullRequestModel(BaseModel):'
1316 1316 # to either the source repo, the target repo or no repo at all.
1317 1317 ChangesetComment.repo_id == pull_request.target_repo.repo_id,
1318 1318 ChangesetComment.pull_request == pull_request,
1319 ChangesetComment.pull_request_version == None)\
1319 ChangesetComment.pull_request_version == null())\
1320 1320 .order_by(ChangesetComment.comment_id.asc())
1321 1321
1322 1322 # TODO: johbo: Find out why this breaks if it is done in a bulk
@@ -46,7 +46,7 b' from rhodecode.lib.str_utils import safe'
46 46 from rhodecode.lib.system_info import get_system_info
47 47 from rhodecode.model import BaseModel
48 48 from rhodecode.model.db import (
49 or_, false,
49 or_, false, null,
50 50 Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup,
51 51 PullRequest, FileStore)
52 52 from rhodecode.model.settings import VcsSettingsModel
@@ -249,7 +249,7 b' class ScmModel(BaseModel):'
249 249 """
250 250 if all_repos is None:
251 251 all_repos = self.sa.query(Repository)\
252 .filter(Repository.group_id == None)\
252 .filter(Repository.group_id == null())\
253 253 .order_by(func.lower(Repository.repo_name)).all()
254 254 repo_iter = SimpleCachedRepoList(
255 255 all_repos, repos_path=self.repos_path, order_by=sort_key)
@@ -258,7 +258,7 b' class ScmModel(BaseModel):'
258 258 def get_repo_groups(self, all_groups=None):
259 259 if all_groups is None:
260 260 all_groups = RepoGroup.query()\
261 .filter(RepoGroup.group_parent_id == None).all()
261 .filter(RepoGroup.group_parent_id == null()).all()
262 262 return [x for x in RepoGroupList(all_groups)]
263 263
264 264 def mark_for_invalidation(self, repo_name, delete=False):
@@ -371,7 +371,7 b' class ScmModel(BaseModel):'
371 371 repo = self._get_repo(repo)
372 372 return self.sa.query(FileStore)\
373 373 .filter(FileStore.repo == repo)\
374 .filter(or_(FileStore.hidden == None, FileStore.hidden == false())).count()
374 .filter(or_(FileStore.hidden == null(), FileStore.hidden == false())).count()
375 375
376 376 def mark_as_fork(self, repo, fork, user):
377 377 repo = self._get_repo(repo)
General Comments 0
You need to be logged in to leave comments. Login now