Changes between Version 2 and Version 3 of Ticket #26988
- Timestamp:
- Aug 2, 2016, 5:38:40 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26988 – Description
v2 v3 3 3 It turns out I was checking for a logged in user with {{{if request.user.is_authenticated is False:}}}, but the {{{is_authenticated}}} property is actually a {{{CallableBool}}} which cannot be tested with {{== False}}, {{is False}}, {{== True}} or {{is True}}. 4 4 5 Checking this property only gives logical results with direct {{{if user.is_authenticated}}} or {{{if not user.is_authenticated}}}. This is very misleading and non-intuitive behaviour (at odds with [https://www.python.org/dev/peps/pep-0008/#programming-recommendations PEP8 (bottom of linked section)] and should be fixed or strongly called out in the documentation. Example:5 Checking this property only gives logical results with direct {{{if user.is_authenticated}}} or {{{if not user.is_authenticated}}}. This is very misleading and non-intuitive behaviour (at odds with [https://www.python.org/dev/peps/pep-0008/#programming-recommendations PEP8 (bottom of linked section)]) and should be fixed or strongly called out in the documentation. Example: 6 6 7 7 {{{