Opened 3 years ago

Last modified 3 years ago

#5152 enhancement new

A new and improved IResource

Reported by: lvh Owned by: itamar
Priority: normal Milestone:
Component: web Keywords:
Cc: jknight, itamar Branch:
Author: lvh Launchpad Bug:

Description (last modified by exarkun)

There are a number of problems with IResource. A (possibly non-exhaustive) list:

  1. #3711 (returning deferreds from render methods)
  2. #3621 (returning deferreds from getChild and friends)
  3. #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 3 years ago by DefaultCC Plugin

  • Cc jknight added

comment:2 Changed 3 years ago by exarkun

  • Description modified (diff)

comment:3 Changed 3 years ago by lvh

exarkun has noted that we should probably have something like Nevow's locateChild rather than IResource's getChild.

comment:4 Changed 3 years ago by itamar

  • Cc itamar 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 3 years ago by itamar

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 3 years ago by itamar

Here is a proposed series of steps, each of which can be reviewed separately:

  1. New resource model with locateChild, and render ala web2. In particular, return a Response object from render 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.
  1. Add support for streaming request bodies, e.g. for POST.
  1. Method dispatching in render (to render_GET, render_HEAD, etc.).
  1. Add support for POSTed forms, including file uploads.
  1. Update documentation.

comment:7 Changed 3 years ago by itamar

  • Owner set to itamar

I need to write up this plan in much more detail on a wiki page.

Note: See TracTickets for help on using tickets.