Change PasswordResetForm.get_users() to return Iterable, not Iterator. (#678)

This matches the actual implementation in Django, where it only attempts
to use the result of get_users() in a for loop, which allows for any
Iterable, and it provides a more flexible and idiomatic API for users
who subclass PasswordResetForm.
This commit is contained in:
Richard Xia
2021-07-29 02:35:28 -07:00
committed by GitHub
parent 0d7c32f38e
commit 08a662ecb1

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Iterator, Optional
from typing import Any, Dict, Iterable, Optional
from django import forms
from django.contrib.auth.base_user import AbstractBaseUser
@@ -53,7 +53,7 @@ class PasswordResetForm(forms.Form):
to_email: str,
html_email_template_name: Optional[str] = ...,
) -> None: ...
def get_users(self, email: str) -> Iterator[Any]: ...
def get_users(self, email: str) -> Iterable[Any]: ...
def save(
self,
domain_override: Optional[str] = ...,