Ticket #5152 enhancement new

Opened 2 years ago

Last modified 16 months ago

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) (diff)

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

1

Changed 2 years ago by DefaultCC Plugin

  • cc jknight added

2

Changed 2 years ago by exarkun

  • description modified (diff)

3

Changed 2 years ago by lvh

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

4

Changed 19 months 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.

5

Changed 19 months 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.

6

Changed 19 months 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.

2. Add support for streaming request bodies, e.g. for POST.

3. Method dispatching in render (to render_GET, render_HEAD, etc.).

4. Add support for POSTed forms, including file uploads.

5. Update documentation.

7

Changed 18 months ago by itamar

  • owner set to itamar

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

8

Note: See TracTickets for help on using tickets.