Omit redundant "if" judgements
django/contrib/admin/views/decorators.py:
if request.user.is_authenticated() and request.user.is_staff:
### COMMENT: request.user.is_staff is True
implied that request.user.is_authenticated()
is True, so request.user.is_authenticated()
could be omitted.
docs/authentication.txt:
if not (request.user.is_authenticated() and request.user.has_perm('polls.can_vote')):
### COMMENT: request.user.has_perm('polls.can_vote') is True
implied that request.user.is_authenticated()
is True, so request.user.is_authenticated()
could be omitted.
p.s. may save some precious cpu cycles on Google App Engine. :P
Change History
(10)
Description: |
modified (diff)
|
Keywords: |
nfa-someday added; Omit redundant "if" judgements removed
|
Triage Stage: |
Unreviewed → Design decision needed
|
Version: |
SVN → newforms-admin
|
Owner: |
changed from nobody to Alexander Koshelev
|
Has patch: |
set
|
Keywords: |
ep2008 added
|
Patch needs improvement: |
set
|
Triage Stage: |
Design decision needed → Accepted
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Keywords: |
yandex-sprint added
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Like #6990, these checks were not redundant before the fix for #3032. They are still there in newforms-admin so someone needs to decide if it is worth removing them.