summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-10-10 09:35:56 -0400
committerTim Graham <timograham@gmail.com>2013-10-10 09:35:56 -0400
commitcec11a3336c730e6dc2f1966fee749cc830e97c0 (patch)
tree014c34809c0d39ca63c711e6168d297b9de013b3 /django
parentff9e8eccf89fc1dce441736c39dcb6e218ca8940 (diff)
Used "is" for comparisons with None.
Diffstat (limited to 'django')
-rw-r--r--django/core/mail/message.py3
-rw-r--r--django/forms/widgets.py2
-rw-r--r--django/middleware/cache.py2
-rw-r--r--django/template/defaulttags.py2
-rw-r--r--django/test/_doctest.py2
5 files changed, 6 insertions, 5 deletions
diff --git a/django/core/mail/message.py b/django/core/mail/message.py
index 2f24688d42..85699aacec 100644
--- a/django/core/mail/message.py
+++ b/django/core/mail/message.py
@@ -292,7 +292,8 @@ class EmailMessage(object):
into the resulting message attachments.
"""
if isinstance(filename, MIMEBase):
- assert content == mimetype == None
+ assert content is None
+ assert mimetype is None
self.attachments.append(filename)
else:
assert content is not None
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index f8320117f7..678b963e7e 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -508,7 +508,7 @@ class Select(Widget):
return mark_safe('\n'.join(output))
def render_option(self, selected_choices, option_value, option_label):
- if option_value == None:
+ if option_value is None:
option_value = ''
option_value = force_text(option_value)
if option_value in selected_choices:
diff --git a/django/middleware/cache.py b/django/middleware/cache.py
index 55b61358ea..dbd5b80fb2 100644
--- a/django/middleware/cache.py
+++ b/django/middleware/cache.py
@@ -96,7 +96,7 @@ class UpdateCacheMiddleware(object):
# Control" header before reverting to using the default cache_timeout
# length.
timeout = get_max_age(response)
- if timeout == None:
+ if timeout is None:
timeout = self.cache_timeout
elif timeout == 0:
# max-age was set to 0, don't bother caching.
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 798323c2cf..bc9cfc1c8f 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -315,7 +315,7 @@ class RegroupNode(Node):
def render(self, context):
obj_list = self.target.resolve(context, True)
- if obj_list == None:
+ if obj_list is None:
# target variable wasn't found in context; fail silently.
context[self.var_name] = []
return ''
diff --git a/django/test/_doctest.py b/django/test/_doctest.py
index 3f6962dc17..4f4837f3c6 100644
--- a/django/test/_doctest.py
+++ b/django/test/_doctest.py
@@ -1345,7 +1345,7 @@ class DocTestRunner:
# exception message will be in group(2)
m = re.match(r'(.*)\.(\w+:.+\s)', exc_msg)
# make sure there's a match
- if m != None:
+ if m is not None:
f_name = m.group(1)
# check to see if m.group(1) contains the module name
if f_name == exception[0].__module__: