plone / plone/plone.restapi

Adaptor implementations should be generic, they should not directly read request.form

Open
#1,604 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
109
Forks
107
Avg merge
2d 3h
Merged PRs (30d)
4

Description

An adapter should be a reusable piece of infrastructure. Its implementation should be as generic as possible. But here, and in many other places, we have the adaptors directly reading the request form. This makes them difficult to use. It's the equivalent of depending on a single global variable (the request.form) that's used across the whole system. That's not flexible.

https://github.com/plone/plone.restapi/blob/b15ddc03e1add4197458f8ba55551e62a0d58b3d/src/plone/restapi/serializer/summary.py#L80

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 with src/plone/restapi/serializer/summary.py at the linked implementation, then inspect the other adapter implementations that directly read request.form. Trace how adapter inputs are currently supplied and define a reusable input path that does not depend on the request form. Done means the affected adapters no longer directly read request.form and their existing behavior remains covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.