plone / plone/plone.api

The parameter validation decorators should be reworked.

Open
#248 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Parameter validation is currently handled by function decorators. This has the following downsides:
A. Required parameters are defined with '=None'.
This is really non-pythonic and unhelpful to IDEs and (more) experienced programmers.
Required arguments should never have a default value.

B. Debugging the function calls is more-or-less impossible.
If you try to PDB into an plone.api function, the only thing you'll see is '(1)create()'. This is the same problem we have with TTW python scripts.

There's also the overhead of function calls, but that's clearly moot when you're creating content, or doing a workflow transition.

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 by locating the function decorators that handle parameter validation and the affected plone.api functions; the issue does not name specific files or tests. Establish the replacement design for required arguments and debuggable calls, then add or update coverage showing both behaviors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.