mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26544 -- Delayed translations of SetPasswordForm help_texts
Thanks Michael Bitzi for the reporti and Tim Graham for the review.
This commit is contained in:
@@ -10,9 +10,10 @@ from django.core.exceptions import ImproperlyConfigured, ValidationError
|
||||
from django.utils import lru_cache
|
||||
from django.utils._os import upath
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.functional import lazy
|
||||
from django.utils.html import format_html
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils.six import string_types
|
||||
from django.utils.six import string_types, text_type
|
||||
from django.utils.translation import ugettext as _, ungettext
|
||||
|
||||
|
||||
@@ -77,7 +78,7 @@ def password_validators_help_texts(password_validators=None):
|
||||
return help_texts
|
||||
|
||||
|
||||
def password_validators_help_text_html(password_validators=None):
|
||||
def _password_validators_help_text_html(password_validators=None):
|
||||
"""
|
||||
Return an HTML string with all help texts of all configured validators
|
||||
in an <ul>.
|
||||
@@ -85,6 +86,7 @@ def password_validators_help_text_html(password_validators=None):
|
||||
help_texts = password_validators_help_texts(password_validators)
|
||||
help_items = [format_html('<li>{}</li>', help_text) for help_text in help_texts]
|
||||
return '<ul>%s</ul>' % ''.join(help_items) if help_items else ''
|
||||
password_validators_help_text_html = lazy(_password_validators_help_text_html, text_type)
|
||||
|
||||
|
||||
class MinimumLengthValidator(object):
|
||||
|
||||
Reference in New Issue
Block a user