File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1- from jinja2 import Template
1+ try :
2+ from jinja2 import Template
3+ except ImportError :
4+ from string import Template
25
36from commitizen import defaults
47from commitizen .cz .base import BaseCommitizen
@@ -27,7 +30,10 @@ def questions(self) -> list:
2730
2831 def message (self , answers : dict ) -> str :
2932 message_template = Template (self .custom_config .get ("message_template" ))
30- return message_template .render (** answers )
33+ if getattr (Template , "substitute" , None ):
34+ return message_template .substitute (** answers )
35+ else :
36+ return message_template .render (** answers )
3137
3238 def example (self ) -> str :
3339 return self .custom_config .get ("example" )
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ colorama = "^0.4.1"
5151termcolor = " ^1.1"
5252packaging = " ^19.0"
5353tomlkit = " ^0.5.3"
54- jinja2 = " ^2.10.3"
54+ jinja2 = { version = " ^2.10.3" , optional = true }
5555
5656[tool .poetry .dev-dependencies ]
5757ipython = " ^7.2"
You can’t perform that action at this time.
0 commit comments