mirror of https://github.com/MISP/PyMISP
Linting
parent
c797f4dfc4
commit
914ac84194
|
@ -566,18 +566,18 @@ class PyMISP(object):
|
||||||
"""
|
"""
|
||||||
if isinstance(attachment, basestring) and os.path.isfile(attachment):
|
if isinstance(attachment, basestring) and os.path.isfile(attachment):
|
||||||
# We have a file to open
|
# We have a file to open
|
||||||
if filename == None:
|
if filename is None:
|
||||||
filename = os.path.basename(attachment)
|
filename = os.path.basename(attachment)
|
||||||
with open(attachment, "rb") as f:
|
with open(attachment, "rb") as f:
|
||||||
fileData = f.read()
|
fileData = f.read()
|
||||||
elif hasattr(attachment, "read"):
|
elif hasattr(attachment, "read"):
|
||||||
# It's a file handle - we can read it but it has no filename
|
# It's a file handle - we can read it but it has no filename
|
||||||
fileData = attachment.read()
|
fileData = attachment.read()
|
||||||
if filename == None:
|
if filename is None:
|
||||||
filename = 'attachment'
|
filename = 'attachment'
|
||||||
elif isinstance(attachment, (tuple, list)):
|
elif isinstance(attachment, (tuple, list)):
|
||||||
# tuple/list (filename, pseudofile)
|
# tuple/list (filename, pseudofile)
|
||||||
if filename == None:
|
if filename is None:
|
||||||
filename = attachment[0]
|
filename = attachment[0]
|
||||||
if hasattr(attachment[1], "read"):
|
if hasattr(attachment[1], "read"):
|
||||||
# Pseudo file
|
# Pseudo file
|
||||||
|
@ -586,7 +586,7 @@ class PyMISP(object):
|
||||||
fileData = attachment[1]
|
fileData = attachment[1]
|
||||||
else:
|
else:
|
||||||
# Plain file content, no filename
|
# Plain file content, no filename
|
||||||
if filename == None:
|
if filename is None:
|
||||||
filename = 'attachment'
|
filename = 'attachment'
|
||||||
fileData = attachment
|
fileData = attachment
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue