Skip to content

Commit 65ac16c

Browse files
Update django.core.handlers (#2660)
1 parent 186b0d9 commit 65ac16c

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

django-stubs/core/handlers/asgi.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from collections.abc import Awaitable, Callable, Iterator, Mapping, Sequence
22
from logging import Logger
33
from typing import IO, Any, TypeAlias, TypeVar
44

5+
from django.core.files import uploadedfile
56
from django.core.handlers import base
67
from django.http.request import HttpRequest, _ImmutableQueryDict
78
from django.http.response import HttpResponseBase
@@ -30,7 +31,8 @@ class ASGIRequest(HttpRequest):
3031
@cached_property
3132
def GET(self) -> _ImmutableQueryDict: ... # type: ignore[override]
3233
POST: _ImmutableQueryDict
33-
FILES: MultiValueDict
34+
@property
35+
def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile]: ... # type: ignore[override]
3436
@cached_property
3537
def COOKIES(self) -> dict[str, str]: ... # type: ignore[override]
3638

django-stubs/core/handlers/wsgi.pyi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import sys
22
from io import BytesIO, IOBase
33
from typing import Any
44

5+
from django.core.files import uploadedfile
56
from django.core.handlers import base
67
from django.http import HttpRequest
8+
from django.http.request import _ImmutableQueryDict
79
from django.http.response import HttpResponseBase
10+
from django.utils.datastructures import MultiValueDict
11+
from django.utils.functional import cached_property
812

913
if sys.version_info >= (3, 11):
1014
from wsgiref.types import StartResponse, WSGIEnvironment
@@ -20,6 +24,12 @@ class LimitedStream(IOBase):
2024
class WSGIRequest(HttpRequest):
2125
environ: WSGIEnvironment
2226
def __init__(self, environ: WSGIEnvironment) -> None: ...
27+
@cached_property
28+
def GET(self) -> _ImmutableQueryDict: ... # type: ignore[override]
29+
@cached_property
30+
def COOKIES(self) -> dict[str, str]: ... # type: ignore[override]
31+
@property
32+
def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile]: ... # type: ignore[override]
2333

2434
class WSGIHandler(base.BaseHandler):
2535
request_class: type[WSGIRequest]

scripts/stubtest/allowlist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ django.core.files.storage.memory.InMemoryStorage.file_permissions_mode
236236
django.core.files.storage.memory.InMemoryStorage.location
237237
django.core.handlers.asgi.ASGIRequest.COOKIES
238238
django.core.handlers.asgi.ASGIRequest.GET
239+
django.core.handlers.wsgi.WSGIRequest.COOKIES
240+
django.core.handlers.wsgi.WSGIRequest.GET
239241
django.core.management.commands.loaddata.Command.compression_formats
240242
django.core.management.commands.loaddata.Command.fixture_dirs
241243
django.core.management.commands.makemessages.BuildFile.is_templatized

scripts/stubtest/allowlist_todo.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,6 @@ django.core.files.utils.FileProxyMixin.tell
431431
django.core.files.utils.FileProxyMixin.truncate
432432
django.core.files.utils.FileProxyMixin.write
433433
django.core.files.utils.FileProxyMixin.writelines
434-
django.core.handlers.asgi.ASGIRequest.FILES
435-
django.core.handlers.wsgi.WSGIRequest.COOKIES
436-
django.core.handlers.wsgi.WSGIRequest.FILES
437-
django.core.handlers.wsgi.WSGIRequest.GET
438434
django.core.mail.backends.filebased.EmailBackend.__init__
439435
django.core.mail.backends.locmem.EmailBackend.send_messages
440436
django.core.mail.backends.smtp.EmailBackend.__init__

0 commit comments

Comments
 (0)