Opened 8 years ago
Last modified 7 years ago
#5152 enhancement new
A new and improved IResource
Reported by: | lvh | Owned by: | Itamar Turner-Trauring |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | web | Keywords: | |
Cc: | jknight, Itamar Turner-Trauring | Branch: | |
Author: | lvh |
Description (last modified by )
There are a number of problems with IResource. A (possibly non-exhaustive) list:
- #3711 (returning deferreds from render methods)
- #3621 (returning deferreds from getChild and friends)
- #288 (accessing uploaded data while in progress)
None of these problems can be fixed without breaking IResource, which is something we don't want to do. As a result, we need a new IResource interface.
The goal of this ticket is to produce that interface, and to introduce fixes for each individual ticket into an integration branch related to this interface. That way, once all the tickets have been addressed, we can just merge this into trunk.
Change History (8)
comment:1 Changed 8 years ago by
Cc: | jknight added |
---|
comment:2 Changed 8 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 8 years ago by
comment:4 Changed 7 years ago by
Cc: | Itamar Turner-Trauring added |
---|
If we have a new resource implementation with locateChild
, ala Nevow or web2, we can require that locateChild
implementations not depend on the body of request. That means we can add support for streaming uploads (#288) in a separate branch, thus allowing more incremental development.
comment:5 Changed 7 years ago by
Although I guess you wouldn't want to have it using the old API for looking at bodies, so maybe it does need to be one fell swoop.
comment:6 Changed 7 years ago by
Here is a proposed series of steps, each of which can be reviewed separately:
- New resource model with
locateChild
, andrender
ala web2. In particular, return aResponse
object fromrender
that has response code, headers, and body producer. Actual design details may differ. The new resource would be default for twisted.web, and old resources would have backwards compatibility layer.
- Add support for streaming request bodies, e.g. for POST.
- Method dispatching in
render
(torender_GET
,render_HEAD
, etc.).
- Add support for POSTed forms, including file uploads.
- Update documentation.
comment:7 Changed 7 years ago by
Owner: | set to Itamar Turner-Trauring |
---|
I need to write up this plan in much more detail on a wiki page.
comment:8 Changed 7 years ago by
Beginning of plan: http://twistedmatrix.com/trac/wiki/WebResourceImprovements
exarkun has noted that we should probably have something like Nevow's
locateChild
rather than IResource'sgetChild
.