summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/utils/text.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/django/utils/text.py b/django/utils/text.py
index f51113b483..3b8fc581bf 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -7,7 +7,9 @@ from io import BytesIO
from django.utils import six
from django.utils.encoding import force_text
-from django.utils.functional import SimpleLazyObject, keep_lazy, keep_lazy_text
+from django.utils.functional import (
+ SimpleLazyObject, keep_lazy, keep_lazy_text, lazy,
+)
from django.utils.safestring import SafeText, mark_safe
from django.utils.six.moves import html_entities
from django.utils.translation import pgettext, ugettext as _, ugettext_lazy
@@ -434,3 +436,12 @@ def camel_case_to_spaces(value):
trailing whitespace.
"""
return re_camel_case.sub(r' \1', value).strip().lower()
+
+
+def _format_lazy(format_string, *args, **kwargs):
+ """
+ Apply str.format() on 'format_string' where format_string, args,
+ and/or kwargs might be lazy.
+ """
+ return format_string.format(*args, **kwargs)
+format_lazy = lazy(_format_lazy, six.text_type)