Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create content_type: jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'is_plone5' #69

Open
fulv opened this issue May 12, 2021 · 1 comment

Comments

@fulv
Copy link
Member

fulv commented May 12, 2021

  • 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'```
@fulv
Copy link
Member Author

fulv commented May 12, 2021

I found this problem:


> /usr/local/plone-5.2/zeoserver/lib/python3.6/site-packages/bobtemplates/plone/base.py(201)read_bobtemplates_ini()
-> path = configurator.target_directory + "/bobtemplate.cfg"
(Pdb) configurator.target_directory
'/usr/local/plone-5.2/zeoserver/src/my.package/my.package'

Somehow, my.package ends up getting added twice at the end of the target_directory

Then I did this:

(Pdb) configurator.target_directory = '/usr/local/plone-5.2/zeoserver/src/my.package'
(Pdb) c

And it completed without the error above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant