def _createTxtFilestream(self, strData, **kwargs):
"""
Helper function to create filestream for upload.
Parameters :
strData : str, test string data
Optional Arguments :
filename : str, Defaults to 'test.txt'
"""
filename = kwargs.get('filename', 'test.txt')
data = strData.encode('utf-8')
filedata = BytesIO(data)
filestream = InMemoryUploadedFile(
filedata,
None,
filename,
'text',
len(data),
None
)
return filestream
评论列表
文章目录