Closed agitator closed 3 years ago
Same here on Ubuntu if following these steps.
if I put a conditional debugger in mrbob/rendering.py
like so:
def render_template(fs_source, fs_target_dir, variables, verbose, renderer):
filename = path.split(fs_source)[1]
if filename.endswith('.bob'):
filename = filename.split('.bob')[0]
fs_target_path = path.join(fs_target_dir, render_filename(filename, variables))
if verbose:
print(six.u("Rendering %s to %s") % (fs_source, fs_target_path))
fs_source_mode = stat.S_IMODE(os.stat(fs_source).st_mode)
with codecs.open(fs_source, 'r', 'utf-8') as f:
source_output = f.read()
try:
output = renderer(source_output, variables)
except Exception as e:
breakpoint()
# append newline due to jinja2 bug, see https://github.com/iElectric/mr.bob/issues/30
if source_output.endswith('\n') and not output.endswith('\n'):
the I find it happens while genratig the FTI. The current variables are like so:
{'dexterity_parent_container_type_name': None,
'dexterity_type_activate_default_behaviors': True,
'dexterity_type_base_class': 'Container',
'dexterity_type_create_class': None,
'dexterity_type_desc': '',
'dexterity_type_filter_content_types': False,
'dexterity_type_fti_file_name': 'Todo_Task',
'dexterity_type_global_allow': True,
'dexterity_type_name': 'Todo Task',
'dexterity_type_name_klass': 'TodoTask',
'dexterity_type_name_normalized': 'todo_task',
'dexterity_type_supermodel': True,
'package.dottedname': 'hello.site',
'package.name': 'site',
'package.namespace': 'hello',
'package.root_folder': '/home/jensens/ws/sandbox/hello.site',
'package.uppercasename': 'HELLO_SITE',
'package_folder': '/home/jensens/ws/sandbox/hello.site/src/hello/site',
'package_folder_rel_path': '/src/hello/site',
'plone.version': None,
'subtemplate_warning': None,
'template_id': 'content_type',
'year': 2021}
Confusing, no idea whats going on there.
The point is that you are doing plonecli create content_type greeting
and you should be doing plonecli add content_type greeting
plonecli create
works for top-level templates, and plonecli add
should be used for subtemplates
This is indeed true! So the bug here is, bobtemplates does not cry out loud if impossible parameters are given. Better validation seems the key.
i just fixed a bug with the version reading and setting these vars, this might be also have been a problem. I'll close this issue for now, feel fre to open it when this is still a problem.
created new user, fresh venv from os python