Lines 75-89
def upload(self, request):
|
Link Here
|
---|
|
75 |
if not isinstance(request.options, (tuple, list)): |
75 |
if not isinstance(request.options, (tuple, list)): |
76 |
raise UMC_OptionTypeError( 'Expected list of dicts, but got: %s' % str(request.options) ) |
76 |
raise UMC_OptionTypeError( 'Expected list of dicts, but got: %s' % str(request.options) ) |
77 |
|
77 |
|
|
|
78 |
# create a temporary upload directory, if it does not already exist |
79 |
if not self._tmpDir: |
80 |
self._tmpDir = tempfile.mkdtemp(prefix='ucsschool-distribution-upload-') |
81 |
MODULE.info('Created temporary directory: %s' % self._tmpDir) |
82 |
|
78 |
for file in request.options: |
83 |
for file in request.options: |
79 |
if not ('tmpfile' in file and 'filename' in file): |
84 |
if not ('tmpfile' in file and 'filename' in file): |
80 |
raise UMC_OptionTypeError( 'Invalid upload data, got: %s' % str(file) ) |
85 |
raise UMC_OptionTypeError( 'Invalid upload data, got: %s' % str(file) ) |
81 |
|
86 |
|
82 |
# create a temporary upload directory, if it does not already exist |
|
|
83 |
if not self._tmpDir: |
84 |
self._tmpDir = tempfile.mkdtemp(prefix='ucsschool-distribution-upload-') |
85 |
MODULE.info('Created temporary directory: %s' % self._tmpDir) |
86 |
|
87 |
filename = self.__workaround_filename_bug(file) |
87 |
filename = self.__workaround_filename_bug(file) |
88 |
destPath = os.path.join(self._tmpDir, filename) |
88 |
destPath = os.path.join(self._tmpDir, filename) |
89 |
MODULE.info('Received file %r, saving it to %r' % (file['tmpfile'], destPath)) |
89 |
MODULE.info('Received file %r, saving it to %r' % (file['tmpfile'], destPath)) |