Plone.api set content types that can be added to folder

Is it possible with plone.api ( plone.api.content.create ) to set which content types that can be added to a folder?

2 Likes

For later reference, I paste it here as text:

from plone.base.interfaces import constrains

#my-folder is in root of the site
my_folder = portal.get('my-folder', False)
behaviour = constrains.ISelectableConstrainTypes(my_folder)

behaviour.setConstrainTypesMode(constrains.ENABLED)
behaviour.setImmediatelyAddableTypes(['my_items'])
behaviour.setLocallyAllowedTypes(['my_items'])