Mercurial > kallithea
comparison rhodecode/controllers/admin/notifications.py @ 3625:260a7a01b054 beta
follow Python conventions for boolean values
True and False might be singletons and the "default" values for "boolean"
expressions, but "all" values in Python has a boolean value and should be
evaluated as such. Checking with 'is True' and 'is False' is thus confusing,
error prone and unnessarily complex.
If we anywhere rely and nullable boolean fields from the database layer and
don't want the null value to be treated as False then we should check
explicitly for null with 'is None'.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 28 Mar 2013 01:10:45 +0100 |
parents | edb9a42def31 |
children | 7efc8dcc0dc4 |
comparison
equal
deleted
inserted
replaced
3624:4dddb7ee8865 | 3625:260a7a01b054 |
---|---|
157 .get_user_notification(c.user.user_id, no) | 157 .get_user_notification(c.user.user_id, no) |
158 | 158 |
159 # if this association to user is not valid, we don't want to show | 159 # if this association to user is not valid, we don't want to show |
160 # this message | 160 # this message |
161 if unotification: | 161 if unotification: |
162 if unotification.read is False: | 162 if not unotification.read: |
163 unotification.mark_as_read() | 163 unotification.mark_as_read() |
164 Session().commit() | 164 Session().commit() |
165 c.notification = no | 165 c.notification = no |
166 | 166 |
167 return render('admin/notifications/show_notification.html') | 167 return render('admin/notifications/show_notification.html') |