plone / plone/plone.api

Remove rename after creation

Open
#421 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

when calling api.content.create omitting the id the parameter, a random id is first created:
https://github.com/plone/plone.api/blob/d2bf66834206cdc58162046b16d1b8d739d6db45/src/plone/api/content.py#L82
Then a new id is computed:
https://github.com/plone/plone.api/blob/d2bf66834206cdc58162046b16d1b8d739d6db45/src/plone/api/content.py#L122
and the object is renamed:
https://github.com/plone/plone.api/blob/d2bf66834206cdc58162046b16d1b8d739d6db45/src/plone/api/content.py#L130

I do not see any reason why the final id is not computed immediately saving the rename operation

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

Read src/plone/api/content.py at the referenced lines to follow how api.content.create handles a missing id, computes the final id, and renames the object. Confirm the creation path can use the final id directly, then check the surrounding behavior to ensure the rename step is no longer needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.