Skip to content

Commit abc6a11

Browse files
authored
Refactor EmPy version handling in template expansion
1 parent 78ff8bb commit abc6a11

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bloom/util.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,10 @@ def expand_template_em(template, subs):
9595
except ImportError:
9696
error("empy was not detected, please install it.", exit=True)
9797

98-
try:
99-
# Try EmPy 4 API first
100-
return em.expand(template, locals=subs)
101-
except (TypeError, NameError):
102-
# Fall back to EmPy 3 API
98+
if em.__version__.startswith('3'):
10399
return em.expand(template, **subs)
100+
else:
101+
return em.expand(template, locals=subs)
104102

105103

106104
def flush_stdin():

0 commit comments

Comments
 (0)