diff rhodecode/lib/rcmail/response.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 d95ef6587bca
children b84c83b651de
line wrap: on
line diff
--- a/rhodecode/lib/rcmail/response.py	Thu Mar 28 01:10:45 2013 +0100
+++ b/rhodecode/lib/rcmail/response.py	Thu Mar 28 01:10:45 2013 +0100
@@ -444,7 +444,7 @@
     try:
         return value.encode("ascii")
     except UnicodeEncodeError:
-        if not_email is False and VALUE_IS_EMAIL_ADDRESS(value):
+        if not not_email and VALUE_IS_EMAIL_ADDRESS(value):
             # this could have an email address, make sure we don't screw it up
             name, address = parseaddr(value)
             return '"%s" <%s>' % (