create content_type: jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'is_plone5'
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
- Plone CLI version: 2.1.2
- Python version: 3.6.9
- Operating System: Ubuntu 18.04
Description
I was trying to add a content type to a package previously created by plonecli.
What I Did
--> Content type name (Allowed: _ a-z A-Z and whitespace) [Todo Task]: PSD X Tool
--> Content type description:
--> Use XML Model [y]: n
--> Dexterity base class (Container/Item) [Container]: Item
--> Should the content type globally addable? [y]:
--> Create a content type class [y]:
--> Activate default behaviors? [y]: n
Traceback (most recent call last):
File "/usr/local/plone-5.2/zeoserver/bin/plonecli", line 8, in <module>
sys.exit(cli())
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/click/core.py", line 1289, in invoke
rv.append(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/plonecli/cli.py", line 91, in create
mrbobmain([bobtemplate, "-O", name])
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/mrbob/cli.py", line 175, in main
c.render()
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/mrbob/configurator.py", line 193, in render
self.ignored_directories)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/mrbob/rendering.py", line 82, in render_structure
renderer,
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/mrbob/rendering.py", line 102, in render_template
output = renderer(source_output, variables)
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/mrbob/rendering.py", line 22, in <lambda>
jinja2_renderer = lambda s, v: jinja2_env.from_string(s).render(parse_variables(v))
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 17, in top-level template code
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'is_plone5'```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the content-type creation flow with the reported Plone CLI and Python versions, then trace the call from plonecli/cli.py through mrbob/configurator.py and mrbob/rendering.py. Inspect the template location reported as line 17 and the variables passed to Jinja2; done means the command completes without the is_plone5 UndefinedError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100