Use a non-empty string in LazyStringEncoder to silence warnings

pull/11869/head
Matt Westcott 2024-04-18 17:28:39 +01:00
rodzic 5a15e6e921
commit 5326736538
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -19,7 +19,9 @@ class LazyStringEncoder(json.JSONEncoder):
translations can be resolved when rendering the widget only.
"""
lazy_string_types = [type(reverse_lazy("")), type(gettext_lazy(""))]
# The string "Edit" here is arbitrary, chosen because it exists elsewhere in the
# translations dictionary and is likely to remain in the future.
lazy_string_types = [type(reverse_lazy("Edit")), type(gettext_lazy("Edit"))]
def default(self, obj):
if type(obj) in self.lazy_string_types: