diff --git a/rhodecode/controllers/admin/notifications.py b/rhodecode/controllers/admin/notifications.py --- a/rhodecode/controllers/admin/notifications.py +++ b/rhodecode/controllers/admin/notifications.py @@ -159,7 +159,7 @@ class NotificationsController(BaseContro # if this association to user is not valid, we don't want to show # this message if unotification: - if unotification.read is False: + if not unotification.read: unotification.mark_as_read() Session().commit() c.notification = no diff --git a/rhodecode/controllers/admin/repos_groups.py b/rhodecode/controllers/admin/repos_groups.py --- a/rhodecode/controllers/admin/repos_groups.py +++ b/rhodecode/controllers/admin/repos_groups.py @@ -348,7 +348,7 @@ class ReposGroupsController(BaseControll .filter(RepoGroup.group_parent_id == c.group.group_id).all() c.groups = self.scm_model.get_repos_groups(groups) - if c.visual.lightweight_dashboard is False: + if not c.visual.lightweight_dashboard: c.repos_list = self.scm_model.get_repos(all_repos=gr_filter) ## lightweight version of dashboard else: diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -416,7 +416,7 @@ class FilesController(BaseRepoController try: dbrepo = RepoModel().get_by_repo_name(repo_name) - if dbrepo.enable_downloads is False: + if not dbrepo.enable_downloads: return _('downloads disabled') if c.rhodecode_repo.alias == 'hg': diff --git a/rhodecode/controllers/home.py b/rhodecode/controllers/home.py --- a/rhodecode/controllers/home.py +++ b/rhodecode/controllers/home.py @@ -52,7 +52,7 @@ class HomeController(BaseController): c.groups = self.scm_model.get_repos_groups() c.group = None - if c.visual.lightweight_dashboard is False: + if not c.visual.lightweight_dashboard: c.repos_list = self.scm_model.get_repos() ## lightweight version of dashboard else: diff --git a/rhodecode/controllers/login.py b/rhodecode/controllers/login.py --- a/rhodecode/controllers/login.py +++ b/rhodecode/controllers/login.py @@ -76,7 +76,7 @@ class LoginController(BaseController): Session().commit() # If they want to be remembered, update the cookie - if c.form_result['remember'] is not False: + if c.form_result['remember']: _year = (datetime.datetime.now() + datetime.timedelta(seconds=60 * 60 * 24 * 365)) session._set_cookie_expires(_year) diff --git a/rhodecode/lib/auth.py b/rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py +++ b/rhodecode/lib/auth.py @@ -381,7 +381,7 @@ class AuthUser(object): if not is_user_loaded: # if we cannot authenticate user try anonymous - if self.anonymous_user.active is True: + if self.anonymous_user.active: user_model.fill_data(self, user_id=self.anonymous_user.user_id) # then we set this user is logged in self.is_authenticated = True diff --git a/rhodecode/lib/celerylib/__init__.py b/rhodecode/lib/celerylib/__init__.py --- a/rhodecode/lib/celerylib/__init__.py +++ b/rhodecode/lib/celerylib/__init__.py @@ -124,7 +124,7 @@ def dbsession(func): ret = func(*fargs, **fkwargs) return ret finally: - if CELERY_ON and CELERY_EAGER is False: + if CELERY_ON and not CELERY_EAGER: meta.Session.remove() return decorator(__wrapper, func) diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py --- a/rhodecode/lib/db_manage.py +++ b/rhodecode/lib/db_manage.py @@ -69,9 +69,9 @@ class DbManage(object): self.init_db() global ask_ok - if self.cli_args.get('force_ask') is True: + if self.cli_args.get('force_ask'): ask_ok = lambda *args, **kwargs: True - elif self.cli_args.get('force_ask') is False: + elif not self.cli_args.get('force_ask'): ask_ok = lambda *args, **kwargs: False def init_db(self): @@ -589,7 +589,7 @@ class DbManage(object): if retries == 0: sys.exit('max retries reached') - if path_ok is False: + if not path_ok: retries -= 1 return self.config_prompt(test_repo_path, retries) diff --git a/rhodecode/lib/diffs.py b/rhodecode/lib/diffs.py --- a/rhodecode/lib/diffs.py +++ b/rhodecode/lib/diffs.py @@ -421,7 +421,7 @@ class DiffProcessor(object): sorter = lambda info: {'A': 0, 'M': 1, 'D': 2}.get(info['operation']) - if inline_diff is False: + if not inline_diff: return diff_container(sorted(_files, key=sorter)) # highlight inline changes diff --git a/rhodecode/lib/hooks.py b/rhodecode/lib/hooks.py --- a/rhodecode/lib/hooks.py +++ b/rhodecode/lib/hooks.py @@ -143,7 +143,7 @@ def log_pull_action(ui, repo, **kwargs): kw.update(ex) callback(**kw) - if ex.make_lock is True: + if ex.make_lock: Repository.lock(Repository.get_by_repo_name(ex.repository), user.user_id) #msg = 'Made lock on repo `%s`' % repository #sys.stdout.write(msg) @@ -202,7 +202,7 @@ def log_push_action(ui, repo, **kwargs): kw.update(ex) callback(**kw) - if ex.make_lock is False: + if not ex.make_lock: Repository.unlock(Repository.get_by_repo_name(ex.repository)) msg = 'Released lock on repo `%s`\n' % ex.repository sys.stdout.write(msg) diff --git a/rhodecode/lib/middleware/simplegit.py b/rhodecode/lib/middleware/simplegit.py --- a/rhodecode/lib/middleware/simplegit.py +++ b/rhodecode/lib/middleware/simplegit.py @@ -126,7 +126,7 @@ class SimpleGit(BaseVCSController): return HTTPInternalServerError()(environ, start_response) # quick check if that dir exists... - if is_valid_repo(repo_name, self.basepath, 'git') is False: + if not is_valid_repo(repo_name, self.basepath, 'git'): return HTTPNotFound()(environ, start_response) #====================================================================== @@ -143,11 +143,11 @@ class SimpleGit(BaseVCSController): anonymous_perm = self._check_permission(action, anonymous_user, repo_name, ip_addr) - if anonymous_perm is not True or anonymous_user.active is False: - if anonymous_perm is not True: + if not anonymous_perm or not anonymous_user.active: + if not anonymous_perm: log.debug('Not enough credentials to access this ' 'repository as anonymous user') - if anonymous_user.active is False: + if not anonymous_user.active: log.debug('Anonymous access is disabled, running ' 'authentication') #============================================================== @@ -184,7 +184,7 @@ class SimpleGit(BaseVCSController): #check permissions for this repository perm = self._check_permission(action, user, repo_name, ip_addr) - if perm is not True: + if not perm: return HTTPForbidden()(environ, start_response) # extras are injected into UI object and later available diff --git a/rhodecode/lib/middleware/simplehg.py b/rhodecode/lib/middleware/simplehg.py --- a/rhodecode/lib/middleware/simplehg.py +++ b/rhodecode/lib/middleware/simplehg.py @@ -89,7 +89,7 @@ class SimpleHg(BaseVCSController): return HTTPInternalServerError()(environ, start_response) # quick check if that dir exists... - if is_valid_repo(repo_name, self.basepath, 'hg') is False: + if not is_valid_repo(repo_name, self.basepath, 'hg'): return HTTPNotFound()(environ, start_response) #====================================================================== @@ -106,11 +106,11 @@ class SimpleHg(BaseVCSController): anonymous_perm = self._check_permission(action, anonymous_user, repo_name, ip_addr) - if anonymous_perm is not True or anonymous_user.active is False: - if anonymous_perm is not True: + if not anonymous_perm or not anonymous_user.active: + if not anonymous_perm: log.debug('Not enough credentials to access this ' 'repository as anonymous user') - if anonymous_user.active is False: + if not anonymous_user.active: log.debug('Anonymous access is disabled, running ' 'authentication') #============================================================== @@ -147,7 +147,7 @@ class SimpleHg(BaseVCSController): #check permissions for this repository perm = self._check_permission(action, user, repo_name, ip_addr) - if perm is not True: + if not perm: return HTTPForbidden()(environ, start_response) # extras are injected into mercurial UI object and later available diff --git a/rhodecode/lib/rcmail/response.py b/rhodecode/lib/rcmail/response.py --- a/rhodecode/lib/rcmail/response.py +++ b/rhodecode/lib/rcmail/response.py @@ -444,7 +444,7 @@ def properly_encode_header(value, encode try: return value.encode("ascii") except UnicodeEncodeError: - if not_email is False and VALUE_IS_EMAIL_ADDRESS(value): + if not not_email and VALUE_IS_EMAIL_ADDRESS(value): # this could have an email address, make sure we don't screw it up name, address = parseaddr(value) return '"%s" <%s>' % ( diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -1698,7 +1698,7 @@ class CacheInvalidation(Base, BaseModel) cache_key = cls._get_cache_key(key) inv = cls._get_or_create_inv_obj(cache_key, repo_name) - if inv and inv.cache_active is False: + if inv and not inv.cache_active: return inv @classmethod diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -100,7 +100,7 @@ class NotificationModel(BaseModel): body=body, recipients=recipients_objs, type_=type_ ) - if with_email is False: + if not with_email: return notif #don't send email to person who created this comment diff --git a/rhodecode/model/permission.py b/rhodecode/model/permission.py --- a/rhodecode/model/permission.py +++ b/rhodecode/model/permission.py @@ -120,7 +120,7 @@ class PermissionModel(BaseModel): .all(): #don't reset PRIVATE repositories - if r2p.repository.private is False: + if not r2p.repository.private: r2p.permission = _def self.sa.add(r2p) diff --git a/rhodecode/model/user.py b/rhodecode/model/user.py --- a/rhodecode/model/user.py +++ b/rhodecode/model/user.py @@ -132,7 +132,7 @@ class UserModel(BaseModel): new_user.username = username new_user.admin = admin # set password only if creating an user or password is changed - if edit is False or user.password != password: + if not edit or user.password != password: new_user.password = get_crypt_password(password) new_user.api_key = generate_api_key(username) new_user.email = email diff --git a/rhodecode/model/users_group.py b/rhodecode/model/users_group.py --- a/rhodecode/model/users_group.py +++ b/rhodecode/model/users_group.py @@ -102,7 +102,7 @@ class UserGroupModel(BaseModel): assigned_groups = UserGroupRepoToPerm.query()\ .filter(UserGroupRepoToPerm.users_group == users_group).all() - if assigned_groups and force is False: + if assigned_groups and not force: raise UserGroupsAssignedException('RepoGroup assigned to %s' % assigned_groups) diff --git a/rhodecode/model/validators.py b/rhodecode/model/validators.py --- a/rhodecode/model/validators.py +++ b/rhodecode/model/validators.py @@ -280,7 +280,7 @@ def ValidAuth(): if not authenticate(username, password): user = User.get_by_username(username) - if user and user.active is False: + if user and not user.active: log.warning('user %s is disabled' % username) msg = M(self, 'disabled_account', state) raise formencode.Invalid(msg, value, state, @@ -503,7 +503,7 @@ def CanWriteGroup(old_data=None): error_dict=dict(repo_type=msg) ) ## check if we can write to root location ! - elif gr is None and can_create_repos() is False: + elif gr is None and not can_create_repos(): msg = M(self, 'permission_denied_root', state) raise formencode.Invalid(msg, value, state, error_dict=dict(repo_type=msg) @@ -533,7 +533,7 @@ def CanCreateGroup(can_create_in_root=Fa #we can create in root, we're fine no validations required return - forbidden_in_root = gr is None and can_create_in_root is False + forbidden_in_root = gr is None and not can_create_in_root val = HasReposGroupPermissionAny('group.admin') forbidden = not val(gr_name, 'can create group validator') if forbidden_in_root or forbidden: diff --git a/rhodecode/templates/files/files_source.html b/rhodecode/templates/files/files_source.html --- a/rhodecode/templates/files/files_source.html +++ b/rhodecode/templates/files/files_source.html @@ -25,7 +25,7 @@ ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): - % if c.on_branch_head and c.changeset.branch and c.file.is_binary is False: + % if c.on_branch_head and c.changeset.branch and not c.file.is_binary: ${h.link_to(_('edit on branch:%s') % c.changeset.branch,h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.branch,f_path=c.f_path),class_="ui-btn")} %else: ${h.link_to(_('edit on branch:?'), '#', class_="ui-btn disabled tooltip", title=_('Editing files allowed only when on branch head revision'))} diff --git a/rhodecode/templates/index_base.html b/rhodecode/templates/index_base.html --- a/rhodecode/templates/index_base.html +++ b/rhodecode/templates/index_base.html @@ -72,7 +72,7 @@ <%cnt=0%> <%namespace name="dt" file="/data_table/_dt_elements.html"/> - % if c.visual.lightweight_dashboard is False: + % if not c.visual.lightweight_dashboard: ## old full detailed version
@@ -131,7 +131,7 @@ % endif - % if c.visual.lightweight_dashboard is False: + % if not c.visual.lightweight_dashboard: