plone / plone/plone.api

plone.api.content.create doesn't adapt behaviors

Open
#457 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

01 type: bug 04 type: enhancement
Dominant language
Python
Stars
101
Forks
62
Avg merge
15h 15m
Merged PRs (30d)
1

Description

When using plone.api.content.create together with Dexterity types which have behaviors with custom behavior factory classes (e.g. with the behavior attribute test123 which sets a marker interface in the behavior factory class instead of an attribute), then content creation leads to unexpected results.
E.g. plone.api.content.create(container, "TestType", "testid", "testtile", test123=True) sets an attribute on the content object instead of a marker interface.

This could be solved when using plone.dexterity.utils.createContentInContainer.

Related:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the plone.api.content.create entry point and compare its behavior handling with plone.dexterity.utils.createContentInContainer. Reproduce the test123 example using a custom behavior factory, then verify that content creation applies the marker interface rather than setting an attribute.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.