File tree Expand file tree Collapse file tree
openedx/core/djangoapps/util/management/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88from django .conf import settings
99from django .core .management .base import BaseCommand
10-
10+ from django . utils . functional import Promise
1111
1212SETTING_NAME_REGEX = re .compile (r'^[A-Z][A-Z0-9_]*$' )
1313
@@ -78,10 +78,11 @@ def _to_json_friendly_repr(value: object) -> object:
7878 if not isinstance (subkey , (str , int )):
7979 raise ValueError (f"Unexpected dict key { subkey } of type { type (subkey )} " )
8080 return {subkey : _to_json_friendly_repr (subval ) for subkey , subval in value .items ()}
81- if proxy_args := getattr (value , "_proxy____args" , None ):
82- if len (proxy_args ) == 1 and isinstance (proxy_args [0 ], str ):
83- # Print gettext_lazy as simply the wrapped string
84- return proxy_args [0 ]
81+
82+ # Directly convert Promise objects (gettext_lazy) to their string representation
83+ if isinstance (value , Promise ):
84+ return str (value )
85+
8586 try :
8687 module = value .__module__
8788 qualname = value .__qualname__
You can’t perform that action at this time.
0 commit comments