Add explicit set_data/get_data functions

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

Start by reading the Response interface around the existing properties named in the issue, especially content_length and app_iter, and compare the intended data helpers with Werkzeug's approach. Done means an explicit set_data/get_data interface exists and manually assigned Content-Length is not recalculated or removed when app_iter changes; add or update tests for both behaviors.

Written by the indexing model from the issue text.

Description

Instead of using properties, provide proper functions that take a page out of werkzeug's book and provide an easy to use interface that attempts to do the right thing all of the time.

Also, while at it, consider changing when/where Content-Length is generated/set so that something like this:

response = Response()
response.content_length = 150
response.app_iter = someiter

Doesn't re-calculate the content-length, or delete it, unless it was set internally by the Response object. See https://github.com/Pylons/webob/issues/86

Dominant language
Python
Stars
443
Forks
206
PR merge metrics
No merged PRs in 30d

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.

More from Pylons/webob

All issues in Pylons/webob

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.