Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1952 (closed enhancement: migrated)

Opened 10 years ago

Last modified 7 years ago

Backport RESTful dispatch from 2.0

Reported by: kskuhlman Owned by: kskuhlman
Priority: normal Milestone: 1.5
Component: TurboGears Version: 1.5 HEAD
Severity: normal Keywords: REST


Backport the restful object approach of TG 2.0. Both the default() method & the HTTP verb approach that  Rick Copeland and  Mark Ramm have blogged about.

Change History

comment:1 Changed 10 years ago by faide

  • Milestone changed from 1.6 to 1.5

comment:2 Changed 9 years ago by dbrattli

RESTful dispatch should probably implemented using CherryPy?'s builtin MethodDispatcher? ( http://tools.cherrypy.org/wiki/HTTPMethodFiltering)

comment:3 Changed 9 years ago by kskuhlman

  • Status changed from new to assigned

Yes, using CherryPy 3's MethodDispatcher was my original plan. Sorry for not being clear about that.

However, things have become more interesting since then. First, tg 1.1 grew a similar feature, the RESTMethod controller, in r5727 (for #1996, based off of Rick Copeland's blog posting). Second, Dag has proposed a REST dispatch enhancement to CherryPy in their ticket  #897, and also implemented it in  GearShift.

For the time being I've simply merged Rick's implementation to 1.5 (in r6555), but that's purely a result of merging changes from 1.1.

Dag's contributions deserve further examination, and we should reserve the right to revert RESTMethod in 1.5 pending that analysis.

comment:4 Changed 9 years ago by dbrattli

Just wanted to mention that the GearShift REST dispatch is much further developed than the older CP proposal. Supports TG2 style GET_ONE() and GET_ALL() in addition to GET(). You can also set ?_method=PUT or ?_method=DELETE when POSTing which makes it a lot easier to write (form submit) clients. You can also request different formats by adding extensions such as .xml or .json to the end of the identifier requested, and it will be automatically be removed and converted to tg_format parameter that you can match different exposes for. Thus GET /phones/12.xml is identical to GET /phones/12?tg_format=xml

comment:5 Changed 9 years ago by kskuhlman

Dag, thanks for the tip. Sounds like you've made fantastic progress!

Would you be willing to prepare a patch for TG, or would you prefer that I do it? Are you still working on docs, or should I backport the docs from 2.0?

comment:6 Changed 8 years ago by kskuhlman

  • Version changed from to 1.5 HEAD
  • Type changed from defect to enhancement

comment:7 Changed 7 years ago by chrisz

  • Status changed from assigned to closed
  • Resolution set to migrated
Note: See TracTickets for help on using tickets.