14 lines
284 B
Python
14 lines
284 B
Python
|
|
def render(obj, context):
|
||
|
|
|
||
|
|
if isinstance(obj, dict):
|
||
|
|
return {k: render(v, context) for k, v in obj.items()}
|
||
|
|
|
||
|
|
if isinstance(obj, list):
|
||
|
|
return [render(i, context) for i in obj]
|
||
|
|
|
||
|
|
if isinstance(obj, str):
|
||
|
|
return obj.format(**context)
|
||
|
|
|
||
|
|
return obj
|
||
|
|
|