jinja2: Fix zc.buildout related import
jinja2_template imports zc.buildout, but uses zc.buildout.buildout (note the double .buildout). As the result, when tried to use in standalone mode, importing slapos.recipe.template.jinja2_template fails:
In [1]: import slapos.recipe.template.jinja2_template
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import slapos.recipe.template.jinja2_template
File ~/src/wendelin/slapos/slapos.recipe.template/slapos/recipe/template/jinja2_template.py:56
53 raise AssertionError(*args)
54 DEFAULT_CONTEXT['assert'] = _assert
---> 56 _buildout_safe_dumps = getattr(zc.buildout.buildout, 'dumps', None)
57 DUMPS_KEY = 'dumps'
58 DEFAULT_IMPORT_DELIMITER = '/'
AttributeError: module 'zc.buildout' has no attribute 'buildout'
That happens because zc.buildout is just a package and does not import anything from its submodules:
https://lab.nexedi.com/nexedi/slapos.buildout/blob/e9c39301/src/zc/buildout/__init__.py
So the correct way of importing is, thus, import zc.buildout.buildout
.
-> Fix it.
The bug was there since 65cd02ec (Add jinja2-based template recipe entry.)
/cc @vpelletier, @jerome