##// END OF EJS Templates
follow Python conventions for boolean values...
Mads Kiilerich -
r3625:260a7a01 beta
parent child Browse files
Show More
@@ -159,7 +159,7 b' class NotificationsController(BaseContro'
159 159 # if this association to user is not valid, we don't want to show
160 160 # this message
161 161 if unotification:
162 if unotification.read is False:
162 if not unotification.read:
163 163 unotification.mark_as_read()
164 164 Session().commit()
165 165 c.notification = no
@@ -348,7 +348,7 b' class ReposGroupsController(BaseControll'
348 348 .filter(RepoGroup.group_parent_id == c.group.group_id).all()
349 349 c.groups = self.scm_model.get_repos_groups(groups)
350 350
351 if c.visual.lightweight_dashboard is False:
351 if not c.visual.lightweight_dashboard:
352 352 c.repos_list = self.scm_model.get_repos(all_repos=gr_filter)
353 353 ## lightweight version of dashboard
354 354 else:
@@ -416,7 +416,7 b' class FilesController(BaseRepoController'
416 416
417 417 try:
418 418 dbrepo = RepoModel().get_by_repo_name(repo_name)
419 if dbrepo.enable_downloads is False:
419 if not dbrepo.enable_downloads:
420 420 return _('downloads disabled')
421 421
422 422 if c.rhodecode_repo.alias == 'hg':
@@ -52,7 +52,7 b' class HomeController(BaseController):'
52 52 c.groups = self.scm_model.get_repos_groups()
53 53 c.group = None
54 54
55 if c.visual.lightweight_dashboard is False:
55 if not c.visual.lightweight_dashboard:
56 56 c.repos_list = self.scm_model.get_repos()
57 57 ## lightweight version of dashboard
58 58 else:
@@ -76,7 +76,7 b' class LoginController(BaseController):'
76 76 Session().commit()
77 77
78 78 # If they want to be remembered, update the cookie
79 if c.form_result['remember'] is not False:
79 if c.form_result['remember']:
80 80 _year = (datetime.datetime.now() +
81 81 datetime.timedelta(seconds=60 * 60 * 24 * 365))
82 82 session._set_cookie_expires(_year)
@@ -381,7 +381,7 b' class AuthUser(object):'
381 381
382 382 if not is_user_loaded:
383 383 # if we cannot authenticate user try anonymous
384 if self.anonymous_user.active is True:
384 if self.anonymous_user.active:
385 385 user_model.fill_data(self, user_id=self.anonymous_user.user_id)
386 386 # then we set this user is logged in
387 387 self.is_authenticated = True
@@ -124,7 +124,7 b' def dbsession(func):'
124 124 ret = func(*fargs, **fkwargs)
125 125 return ret
126 126 finally:
127 if CELERY_ON and CELERY_EAGER is False:
127 if CELERY_ON and not CELERY_EAGER:
128 128 meta.Session.remove()
129 129
130 130 return decorator(__wrapper, func)
@@ -69,9 +69,9 b' class DbManage(object):'
69 69 self.init_db()
70 70 global ask_ok
71 71
72 if self.cli_args.get('force_ask') is True:
72 if self.cli_args.get('force_ask'):
73 73 ask_ok = lambda *args, **kwargs: True
74 elif self.cli_args.get('force_ask') is False:
74 elif not self.cli_args.get('force_ask'):
75 75 ask_ok = lambda *args, **kwargs: False
76 76
77 77 def init_db(self):
@@ -589,7 +589,7 b' class DbManage(object):'
589 589
590 590 if retries == 0:
591 591 sys.exit('max retries reached')
592 if path_ok is False:
592 if not path_ok:
593 593 retries -= 1
594 594 return self.config_prompt(test_repo_path, retries)
595 595
@@ -421,7 +421,7 b' class DiffProcessor(object):'
421 421
422 422 sorter = lambda info: {'A': 0, 'M': 1, 'D': 2}.get(info['operation'])
423 423
424 if inline_diff is False:
424 if not inline_diff:
425 425 return diff_container(sorted(_files, key=sorter))
426 426
427 427 # highlight inline changes
@@ -143,7 +143,7 b' def log_pull_action(ui, repo, **kwargs):'
143 143 kw.update(ex)
144 144 callback(**kw)
145 145
146 if ex.make_lock is True:
146 if ex.make_lock:
147 147 Repository.lock(Repository.get_by_repo_name(ex.repository), user.user_id)
148 148 #msg = 'Made lock on repo `%s`' % repository
149 149 #sys.stdout.write(msg)
@@ -202,7 +202,7 b' def log_push_action(ui, repo, **kwargs):'
202 202 kw.update(ex)
203 203 callback(**kw)
204 204
205 if ex.make_lock is False:
205 if not ex.make_lock:
206 206 Repository.unlock(Repository.get_by_repo_name(ex.repository))
207 207 msg = 'Released lock on repo `%s`\n' % ex.repository
208 208 sys.stdout.write(msg)
@@ -126,7 +126,7 b' class SimpleGit(BaseVCSController):'
126 126 return HTTPInternalServerError()(environ, start_response)
127 127
128 128 # quick check if that dir exists...
129 if is_valid_repo(repo_name, self.basepath, 'git') is False:
129 if not is_valid_repo(repo_name, self.basepath, 'git'):
130 130 return HTTPNotFound()(environ, start_response)
131 131
132 132 #======================================================================
@@ -143,11 +143,11 b' class SimpleGit(BaseVCSController):'
143 143 anonymous_perm = self._check_permission(action, anonymous_user,
144 144 repo_name, ip_addr)
145 145
146 if anonymous_perm is not True or anonymous_user.active is False:
147 if anonymous_perm is not True:
146 if not anonymous_perm or not anonymous_user.active:
147 if not anonymous_perm:
148 148 log.debug('Not enough credentials to access this '
149 149 'repository as anonymous user')
150 if anonymous_user.active is False:
150 if not anonymous_user.active:
151 151 log.debug('Anonymous access is disabled, running '
152 152 'authentication')
153 153 #==============================================================
@@ -184,7 +184,7 b' class SimpleGit(BaseVCSController):'
184 184
185 185 #check permissions for this repository
186 186 perm = self._check_permission(action, user, repo_name, ip_addr)
187 if perm is not True:
187 if not perm:
188 188 return HTTPForbidden()(environ, start_response)
189 189
190 190 # extras are injected into UI object and later available
@@ -89,7 +89,7 b' class SimpleHg(BaseVCSController):'
89 89 return HTTPInternalServerError()(environ, start_response)
90 90
91 91 # quick check if that dir exists...
92 if is_valid_repo(repo_name, self.basepath, 'hg') is False:
92 if not is_valid_repo(repo_name, self.basepath, 'hg'):
93 93 return HTTPNotFound()(environ, start_response)
94 94
95 95 #======================================================================
@@ -106,11 +106,11 b' class SimpleHg(BaseVCSController):'
106 106 anonymous_perm = self._check_permission(action, anonymous_user,
107 107 repo_name, ip_addr)
108 108
109 if anonymous_perm is not True or anonymous_user.active is False:
110 if anonymous_perm is not True:
109 if not anonymous_perm or not anonymous_user.active:
110 if not anonymous_perm:
111 111 log.debug('Not enough credentials to access this '
112 112 'repository as anonymous user')
113 if anonymous_user.active is False:
113 if not anonymous_user.active:
114 114 log.debug('Anonymous access is disabled, running '
115 115 'authentication')
116 116 #==============================================================
@@ -147,7 +147,7 b' class SimpleHg(BaseVCSController):'
147 147
148 148 #check permissions for this repository
149 149 perm = self._check_permission(action, user, repo_name, ip_addr)
150 if perm is not True:
150 if not perm:
151 151 return HTTPForbidden()(environ, start_response)
152 152
153 153 # extras are injected into mercurial UI object and later available
@@ -444,7 +444,7 b' def properly_encode_header(value, encode'
444 444 try:
445 445 return value.encode("ascii")
446 446 except UnicodeEncodeError:
447 if not_email is False and VALUE_IS_EMAIL_ADDRESS(value):
447 if not not_email and VALUE_IS_EMAIL_ADDRESS(value):
448 448 # this could have an email address, make sure we don't screw it up
449 449 name, address = parseaddr(value)
450 450 return '"%s" <%s>' % (
@@ -1698,7 +1698,7 b' class CacheInvalidation(Base, BaseModel)'
1698 1698 cache_key = cls._get_cache_key(key)
1699 1699 inv = cls._get_or_create_inv_obj(cache_key, repo_name)
1700 1700
1701 if inv and inv.cache_active is False:
1701 if inv and not inv.cache_active:
1702 1702 return inv
1703 1703
1704 1704 @classmethod
@@ -100,7 +100,7 b' class NotificationModel(BaseModel):'
100 100 body=body, recipients=recipients_objs, type_=type_
101 101 )
102 102
103 if with_email is False:
103 if not with_email:
104 104 return notif
105 105
106 106 #don't send email to person who created this comment
@@ -120,7 +120,7 b' class PermissionModel(BaseModel):'
120 120 .all():
121 121
122 122 #don't reset PRIVATE repositories
123 if r2p.repository.private is False:
123 if not r2p.repository.private:
124 124 r2p.permission = _def
125 125 self.sa.add(r2p)
126 126
@@ -132,7 +132,7 b' class UserModel(BaseModel):'
132 132 new_user.username = username
133 133 new_user.admin = admin
134 134 # set password only if creating an user or password is changed
135 if edit is False or user.password != password:
135 if not edit or user.password != password:
136 136 new_user.password = get_crypt_password(password)
137 137 new_user.api_key = generate_api_key(username)
138 138 new_user.email = email
@@ -102,7 +102,7 b' class UserGroupModel(BaseModel):'
102 102 assigned_groups = UserGroupRepoToPerm.query()\
103 103 .filter(UserGroupRepoToPerm.users_group == users_group).all()
104 104
105 if assigned_groups and force is False:
105 if assigned_groups and not force:
106 106 raise UserGroupsAssignedException('RepoGroup assigned to %s' %
107 107 assigned_groups)
108 108
@@ -280,7 +280,7 b' def ValidAuth():'
280 280
281 281 if not authenticate(username, password):
282 282 user = User.get_by_username(username)
283 if user and user.active is False:
283 if user and not user.active:
284 284 log.warning('user %s is disabled' % username)
285 285 msg = M(self, 'disabled_account', state)
286 286 raise formencode.Invalid(msg, value, state,
@@ -503,7 +503,7 b' def CanWriteGroup(old_data=None):'
503 503 error_dict=dict(repo_type=msg)
504 504 )
505 505 ## check if we can write to root location !
506 elif gr is None and can_create_repos() is False:
506 elif gr is None and not can_create_repos():
507 507 msg = M(self, 'permission_denied_root', state)
508 508 raise formencode.Invalid(msg, value, state,
509 509 error_dict=dict(repo_type=msg)
@@ -533,7 +533,7 b' def CanCreateGroup(can_create_in_root=Fa'
533 533 #we can create in root, we're fine no validations required
534 534 return
535 535
536 forbidden_in_root = gr is None and can_create_in_root is False
536 forbidden_in_root = gr is None and not can_create_in_root
537 537 val = HasReposGroupPermissionAny('group.admin')
538 538 forbidden = not val(gr_name, 'can create group validator')
539 539 if forbidden_in_root or forbidden:
@@ -25,7 +25,7 b''
25 25 ${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")}
26 26 ${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")}
27 27 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
28 % if c.on_branch_head and c.changeset.branch and c.file.is_binary is False:
28 % if c.on_branch_head and c.changeset.branch and not c.file.is_binary:
29 29 ${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")}
30 30 %else:
31 31 ${h.link_to(_('edit on branch:?'), '#', class_="ui-btn disabled tooltip", title=_('Editing files allowed only when on branch head revision'))}
@@ -72,7 +72,7 b''
72 72 </div>
73 73 <%cnt=0%>
74 74 <%namespace name="dt" file="/data_table/_dt_elements.html"/>
75 % if c.visual.lightweight_dashboard is False:
75 % if not c.visual.lightweight_dashboard:
76 76 ## old full detailed version
77 77 <div id='repos_list_wrap' class="yui-skin-sam">
78 78 <table id="repos_list">
@@ -131,7 +131,7 b''
131 131 % endif
132 132 </div>
133 133 </div>
134 % if c.visual.lightweight_dashboard is False:
134 % if not c.visual.lightweight_dashboard:
135 135 <script>
136 136 YUD.get('repo_count').innerHTML = ${cnt+1 if cnt else 0};
137 137
@@ -146,7 +146,7 b''
146 146 <div class="input ${summary(c.show_stats)}">
147 147 %if len(c.rhodecode_repo.revisions) == 0:
148 148 ${_('There are no downloads yet')}
149 %elif c.enable_downloads is False:
149 %elif not c.enable_downloads:
150 150 ${_('Downloads are disabled for this repository')}
151 151 %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
152 152 ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")}
@@ -183,7 +183,7 b' def test_clone_with_credentials(no_error'
183 183 else:
184 184 stdout, stderr = Command(cwd).execute(backend, method, clone_url, dest)
185 185 print stdout,'sdasdsadsa'
186 if no_errors is False:
186 if not no_errors:
187 187 if backend == 'hg':
188 188 assert """adding file changes""" in stdout, 'no messages about cloning'
189 189 assert """abort""" not in stderr , 'got error from clone'
General Comments 0
You need to be logged in to leave comments. Login now