Fix comparison operators
authorMagnus Hagander <magnus@hagander.net>
Thu, 3 Jan 2019 20:57:48 +0000 (21:57 +0100)
committerMagnus Hagander <magnus@hagander.net>
Fri, 4 Jan 2019 11:24:06 +0000 (12:24 +0100)
django/archives/mailarchives/views.py
loader/lib/parser.py

index a9b1d33580882a716d35d336aa2684fa5ff0e462..dfb4874af99ab8101e8e3d25c8a6d516cf964b0d 100644 (file)
@@ -670,7 +670,7 @@ def search(request):
 
     if 's' in request.POST:
         list_sort = request.POST['s']
-        if not list_sort in ('d', 'r', 'i'):
+        if list_sort not in ('d', 'r', 'i'):
             list_stort = 'r'
     else:
         list_sort = 'r'
index 334fc34302a1706844d9a669774eb3772929d1fc..d22d8b0cbd1520dacbbf75cef182a1823dc67c67 100644 (file)
@@ -62,7 +62,7 @@ class ArchivesParser(object):
             # mailers that add the same reference more than once. And we can't
             # use a set() to make it unique, because order is very important
             for m in cleaned_msgids:
-                if m and not m in self.parents:
+                if m and m not in self.parents:
                     self.parents.append(m)
 
     def clean_charset(self, charset):
@@ -230,7 +230,7 @@ class ArchivesParser(object):
             # This was not a multipart, but it leaked... Give up!
             return None
         for p in pl:
-            if p.get_params() == None:
+            if p.get_params() is None:
                 # MIME multipart/mixed, but no MIME type on the part
                 log.status("Found multipart/mixed in message '%s', but no MIME type on part. Trying text/plain." % self.msgid)
                 return self.get_payload_as_unicode(p)
@@ -296,7 +296,7 @@ class ArchivesParser(object):
                 # ignore it...
                 return
             for p in container.get_payload():
-                if p.get_params() == None:
+                if p.get_params() is None:
                     continue
                 self.recursive_get_attachments(p)
         elif container.get_content_type() == 'multipart/alternative':
@@ -480,7 +480,7 @@ class ArchivesParser(object):
     _re_mailworkaround = re.compile('"(=\?[^\?]+\?[QB]\?[^\?]+\?=)"', re.IGNORECASE)
 
     def _decode_mime_header(self, hdr, email_workaround):
-        if hdr == None:
+        if hdr is None:
             return None
 
         # Per http://bugs.python.org/issue504152 (and lots of testing), it seems
@@ -524,7 +524,7 @@ class ArchivesParser(object):
     def get_mandatory(self, fieldname):
         try:
             x = self.msg[fieldname]
-            if x == None:
+            if x is None:
                 raise Exception()
             return x
         except: