mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Refs #30422 -- Added test for removing temporary files in MultiPartParser when StopUpload is raised.
This commit is contained in:
parent
5fcfe5361e
commit
21b127bfbc
4 changed files with 30 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue