Add ability to set custom filename (fix InputFile class)

For commands that uses InputFile class
This commit is contained in:
ErgoZ 2015-09-08 20:43:28 +03:00
parent 714adc13ee
commit 4a761d0611

View file

@ -67,6 +67,9 @@ class InputFile(object):
if isinstance(self.input_file, file):
self.input_file_content = self.input_file.read()
if self.data.has_key('filename') and self.data['filename']:
self.filename = self.data['filename']
else:
self.filename = os.path.basename(self.input_file.name)
self.mimetype = mimetypes.guess_type(self.filename)[0] or \
DEFAULT_MIME_TYPE