Skip to content

Commit cd91f4d

Browse files
committed
use mako's TemplateLookup rather than custom code
Related to race-condition observed w/ python3.11, see: sqlalchemy/mako#378 This will likely not fully solve race-conditions, as those also occur between rendering from passed string and from file if called concurrently. However, using lookup from mako consistently is closer to how Mako is intended to be used + there seems to be synchronisation between lookup-calls at least, which should reduce the frequency of concurrency issues.
1 parent 10dfdb6 commit cd91f4d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

concourse/steps/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616
import os
1717

1818
import mako.template
19-
20-
import ci.util
21-
19+
import mako.lookup
2220

2321
steps_dir = os.path.abspath(os.path.dirname(__file__))
22+
template_lookup = mako.lookup.TemplateLookup(directories=(steps_dir,))
2423

2524

2625
def step_template(name):
27-
step_file = ci.util.existing_file(os.path.join(steps_dir, name + '.mako'))
28-
29-
return mako.template.Template(filename=step_file)
26+
return template_lookup.get_template(f'/{name}.mako')
3027

3128

3229
def step_def(name):

0 commit comments

Comments
 (0)