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

'dict object' has no attribute 'is_plone5' #445

Open
NicolasGoeddel opened this issue Oct 4, 2020 · 4 comments
Open

'dict object' has no attribute 'is_plone5' #445

NicolasGoeddel opened this issue Oct 4, 2020 · 4 comments
Assignees

Comments

@NicolasGoeddel
Copy link

I just wanted to add a new content type to my addon and ran into this exception. I am unsure if this is an issue with bobtemplates.plone or mrbob.

As a result it created the following files:

  • content/init.py
  • content/temporay_link.py
  • profiles/default/types.xml.example
  • tests/test_ct_temporary_link.py
  • tests/robot/test_ct_temorary_link.robot

I am still missing the files:

  • profiles/default/types.xml
  • profiles/default/types/temporary_link.xml

And in case you are wondering. The error also appears if the git is clean and when I remove the space in the content types's name.

Here is the whole log:

(zeocluster) nicolas@Spinnweb:~/Plone/zeocluster/src/example.tools.temporarylink$ mrbob -O example.tools.temporarylink bobtemplates.plone:content_type

Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.

Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.



RUN: git status --porcelain --ignore-submodules
git status result:
----------------------------
b' M .gitlab-ci.yml\n M setup.cfg\n M setup.py\n M src/example/tools/temporarylink/tool.py\n?? src/example/tools/temporarylink/cipher.py\n'
--> Please commit your changes, before using a sub-template! Continue anyway? [n/y] [n]: y

--> Content type name (Allowed: _ a-z A-Z and whitespace) [Todo Task]: Temporary Link

--> Content type description: A root for temporary links.

--> Use XML Model [y]: n

--> Dexterity base class (Container/Item) [Container]: Item

--> Should the content type globally addable? [y]: y

--> Create a content type class [y]: y

--> Activate default behaviors? [y]: y


Traceback (most recent call last):
  File "/home/nicolas/Plone/zeocluster/bin/mrbob", line 20, in <module>
    sys.exit(mrbob.cli.main())
  File "/home/nicolas/Plone/buildout-cache/eggs/mr.bob-0.1.2-py3.8.egg/mrbob/cli.py", line 175, in main
    c.render()
  File "/home/nicolas/Plone/buildout-cache/eggs/mr.bob-0.1.2-py3.8.egg/mrbob/configurator.py", line 186, in render
    render_structure(self.template_dir,
  File "/home/nicolas/Plone/buildout-cache/eggs/mr.bob-0.1.2-py3.8.egg/mrbob/rendering.py", line 77, in render_structure
    render_template(
  File "/home/nicolas/Plone/buildout-cache/eggs/mr.bob-0.1.2-py3.8.egg/mrbob/rendering.py", line 102, in render_template
    output = renderer(source_output, variables)
  File "/home/nicolas/Plone/buildout-cache/eggs/mr.bob-0.1.2-py3.8.egg/mrbob/rendering.py", line 22, in <lambda>
    jinja2_renderer = lambda s, v: jinja2_env.from_string(s).render(parse_variables(v))
  File "/home/nicolas/Plone/buildout-cache/eggs/Jinja2-2.11.2-py3.8.egg/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/nicolas/Plone/buildout-cache/eggs/Jinja2-2.11.2-py3.8.egg/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/nicolas/Plone/buildout-cache/eggs/Jinja2-2.11.2-py3.8.egg/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'
@NicolasGoeddel
Copy link
Author

To make it work I removed all conditions where is_plone5 was used. For my case it was enough to change these files:

I don't understand why is_plone5 is missing everywhere. Maybe that can be changed somewhere but I don't know where.

@MrTango MrTango self-assigned this Nov 12, 2020
@MrTango
Copy link
Contributor

MrTango commented Nov 12, 2020

@NicolasGoeddel which version of bobtemplates.plone are you using, in case you have plonecli installed, a plonecli -V will tell you both versions.

@NicolasGoeddel
Copy link
Author

I have not installed plonecli. I did not know about it. But we created a similar script by ourselves which essentially can do the same and much more.
However I just looked into my buildout-cache and there is bobtemplates.plone in version 5.0.4, mr.bob in version 0.1.2 and mr.developer in version 2.0.0.

These are the versions that got installed automatically by the UnifiedInstaller in version 5.2.1 and got upgraded later by the release-5.2.2-version.cfg and a new buildout.

@spanish
Copy link

spanish commented Aug 1, 2021

The same error with plonecli 2.1.2 and bobtemplates.plone 5.2.0.

Solved changing
path = configurator.target_directory + "/bobtemplate.cfg"
to
path = "/myplone/zeocluster/src/my.addon/bobtemplate.cfg"
in
/usr/local/lib/python3.6/dist-packages/bobtemplates/plone/base.py

Regards

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

3 participants