Changed not foo == None to foo is not None in image sniff handler

>>> class foo(object):
       def __eq__(self, other):
           return True

  >>> f = foo()
  >>> f == None
  True
  >>> f is None
  False

-- <http://stackoverflow.com/questions/26595/is-there-any-difference-between-foo-is-none-and-foo-none>
This commit is contained in:
Joar Wandborg 2012-03-08 22:58:16 +01:00
parent 034a0e0b97
commit e2caf5743c

View File

@ -29,7 +29,7 @@ _log = logging.getLogger(__name__)
SUPPORTED_FILETYPES = ['png', 'gif', 'jpg', 'jpeg']
def sniff_handler(media_file, **kw):
if not kw.get('media') == None: # That's a double negative!
if kw.get('media') is not None: # That's a double negative!
name, ext = os.path.splitext(kw['media'].filename)
clean_ext = ext[1:].lower() # Strip the . from ext and make lowercase