twisted / twisted/klein

Don't construct a KleinRequest via adaptation

Open
#378 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
838
Forks
123
Avg merge
7h 58m
Merged PRs (30d)
12

Description

In #359, @glyph notes:

The real problem here though appears to be that we are constructing a KleinRequest via adaptation - apparently for no good reason. Rather than lie about the type of mapper, I think it would make more sense to replace KleinResource.render's invocation with a simple KleinRequest(request, mapper).

Technically what I'm proposing is an incompatible change, but given that KleinRequest(request) gives you a nonsense non-functional object without an attached mapper, I'm OK with a short deprecation cycle here.

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 reading KleinResource.render and the discussion linked from issue #359. Trace how KleinRequest is currently constructed through adaptation, then compare it with the proposed KleinRequest(request, mapper) path. Done means replacing the unnecessary adaptation while addressing the stated short deprecation cycle for KleinRequest(request).

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.