Opened 16 years ago

Last modified 14 years ago

#6991 closed

Omit redundant "if" judgements — at Version 1

Reported by: Liang Feng <hutuworm@…> Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: nfa-someday yandex-sprint ep2008
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

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 (1)

comment:1 by Ramiro Morales, 16 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top