mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-10 16:20:39 +00:00
Further mutable-default fix to template-renderer
This commit is contained in:
@@ -3,7 +3,7 @@ Jinja2 rendering utils, used to generate new strategy and configurations.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Dict
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
||||
def render_template(templatefile: str, arguments: Dict) -> str:
|
||||
@@ -19,11 +19,13 @@ def render_template(templatefile: str, arguments: Dict) -> str:
|
||||
|
||||
|
||||
def render_template_with_fallback(templatefile: str, templatefallbackfile: str,
|
||||
arguments: dict = {}) -> str:
|
||||
arguments: Optional[Dict] = None) -> str:
|
||||
"""
|
||||
Use templatefile if possible, otherwise fall back to templatefallbackfile
|
||||
"""
|
||||
from jinja2.exceptions import TemplateNotFound
|
||||
if arguments is None:
|
||||
arguments = {}
|
||||
try:
|
||||
return render_template(templatefile, arguments)
|
||||
except TemplateNotFound:
|
||||
|
||||
Reference in New Issue
Block a user