Hi, new to the Plone community so I apologize if there is an obvious answer to this question.
I am attempting to create a new Dexterity content type through xml/python, following the training information mastering plone 5, export_code (can't paste a link or I would)
It seems like it should be pretty straight forward, I've added the types.xml file in (from the project root)
collective.example/src/collective/example/profiles/default/types.xml
<?xml version="1.0"?>
<object name="portal_types" meta_type="Plone Types Tool">
<property name="title">Controls the available contenttypes in your portal</property>
<object name="talk" meta_type="Dexterity FTI"/>
<!-- -*- more types can be added here -*- -->
</object>
and then added the talk.xml file in
collective.example/src/collective/example/profiles/default/types/talk.xml
But unfortunately after restarting plone I am still unable to see that new content type, could someone point me in the direction of what I'm missing on this?
I've been looking into making an addon, I'm struggling getting Plone to recognize the addon e.g. I don't see it available to install through the Addons page.
I ran plonecli create addon src/collective.talk
This is my buildout.cfg
[buildout]
# use this extend one of the buildout configuration:
extends =
# -*- mrbob: extra extends -*-
# test_plone43.cfg
# test_plone50.cfg
# test_plone51.cfg
test_plone52.cfg
eggs =
plone.restapi
pas.plugins.ldap
collective.talk
[sources]
collective.talk = fs collective.talk path=src
I've ran bin/buildout and then started plone back up but it is not available to install, folder structure looks like this -
Looks like it is trying to find a distribution for collective.example, I'm assuming from github? Not sure why it would be attempting to do that, collective.example is the root application
Make your add on by using plone cli ( plonecli create addon collective.talk ) and the 'subcommand' plonecli add content_type ( Content Type sub-template — Plone Documentation v5.2 ) . Edit the (xml) files (or you can do this after you know all the other steps below works)
Install Plone with the universal installer
place your add-on in the folder /zinstance/src (if you install with standalone (zeoserver if not)
add your add on to develop section
src= src/collective.talk
add your add on to eggs section
eggs=collective.talk
run bin/buildout
start server (every time you run bin/buildout you need to stop and start server)
I reinstalled plone so I could give these steps a try with a fresh instance, so plone is installed at
~/Plone with the zinstance folder being ~/Plone/zinstance
I ran plonecli create addon collective.talk
plonecli create addon collective.talk
RUN: mrbob bobtemplates.plone:addon -O collective.talk
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.
--> Author's name [FakeGitUserOrEmail]:
--> Author's email [FakeGitUserOrEmail]:
--> Author's GitHub username:
--> Package description [An add-on for Plone]:
--> Do you want me to initialze a GIT repository in your new package? (y/n) [y]: n
--> Plone version [5.2.4]:
--> Python version for virtualenv [python3]: python3.8
--> Do you want me to activate VS Code support? (y/n) [y]: y
Error on isort-apply: isort-apply create: /home/user/Plone/zinstance/src/collective.talk/.tox/isort-apply
ERROR: invocation failed (exit code 1), logfile: /home/user/Plone/zinstance/src/collective.talk/.tox/isort-apply/log/isort-apply-0.log
============================================= log start ==============================================
ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
============================================== log end ===============================================
ERROR: InvocationError for command /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 isort-apply (exited with code 1)
______________________________________________ summary _______________________________________________
ERROR: isort-apply: InvocationError for command /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 isort-apply (exited with code 1)
git init is disabled!
Generated file structure at /home/user/Plone/zinstance/src/collective.talk/collective.talk
then plonecli add content_type
plonecli add content_type
RUN: mrbob 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
fatal: not a git repository (or any of the parent directories): .git
b''
--> 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]:
--> Content type description:
--> Use XML Model [n]:
--> Dexterity base class (Container/Item) [Container]:
--> Should the content type globally addable? [y]:
--> Should we filter content types to be added to this container? [n]:
--> Create a content type class [y]:
--> Activate default behaviors? [y]:
>>> reading Plone version from bobtemplate.cfg
Error on isort-apply: isort-apply create: /home/user/Plone/zinstance/src/collective.talk/.tox/isort-apply
ERROR: invocation failed (exit code 1), logfile: /home/user/Plone/zinstance/src/collective.talk/.tox/isort-apply/log/isort-apply-0.log
============================================= log start ==============================================
ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
============================================== log end ===============================================
ERROR: InvocationError for command /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 isort-apply (exited with code 1)
______________________________________________ summary _______________________________________________
ERROR: isort-apply: InvocationError for command /usr/bin/python3 -m virtualenv --no-download --python /usr/bin/python3 isort-apply (exited with code 1)
Should we run?:
git add .
git commit -m "Add content_type: Todo Task"
in: /home/user/Plone/zinstance/src/collective.talk
[y]/n: n
Skip git commit!
Generated file structure at /home/user/Plone/zinstance/src/collective.talk/src/collective/talk
Then I've added the data onto my buildout.cfg located ~/Plone/zinstance/buildout.cfg
it looks like this now
[buildout]
develop = src/collective.talk
# use this extend one of the buildout configuration:
extends =
# -*- mrbob: extra extends -*-
# test_plone43.cfg
# test_plone50.cfg
# test_plone51.cfg
test_plone52.cfg
eggs = collective.talk
I then stop the plone server, ran sudo bin/buildout and then started the server back up with
sudo bin/plonectl fg
These are all my portal types, not seeing the TODO Task content type I would expect -
@Flagreon,
hmm... that works, though I can see issues in the future
Use the develop.cfg file
There is usually a develop.cfg file. That file is structured for this kind of work. It comes with useful add-ons and settings for "development goodness " (testing infrastructure, auto reloading etc...)
What you're doing will work, but it might be working against the framework in the long run.
The pattern I recommend involves working with the develop.cfg
edit zinstance/develop.cfg
run bin/buildout -c develop.cfg
Here's what a develop.cfg for your scenario would look like (with most comments removed):
So all the packages you're developing ideally go in the develop.cfg. Your buildout.cfg then remains untouched and once you've packaged and deployed your work as an egg it can be explicitly added to the buildout.cfg.