mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #30422 -- Added test for removing temporary files in MultiPartParser when StopUpload is raised.
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
Upload handlers to test the upload API.
|
||||
"""
|
||||
|
||||
from django.core.files.uploadhandler import FileUploadHandler, StopUpload
|
||||
from django.core.files.uploadhandler import (
|
||||
FileUploadHandler, StopUpload, TemporaryFileUploadHandler,
|
||||
)
|
||||
|
||||
|
||||
class QuotaUploadHandler(FileUploadHandler):
|
||||
@@ -27,6 +29,12 @@ class QuotaUploadHandler(FileUploadHandler):
|
||||
return None
|
||||
|
||||
|
||||
class StopUploadTemporaryFileHandler(TemporaryFileUploadHandler):
|
||||
"""A handler that raises a StopUpload exception."""
|
||||
def receive_data_chunk(self, raw_data, start):
|
||||
raise StopUpload()
|
||||
|
||||
|
||||
class CustomUploadError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user