REST and Web2Py

9 views
Skip to first unread message

voltron

unread,
Jan 7, 2008, 4:26:22 AM1/7/08
to Gluon Web Framework
HTML 4 does not include the use of PUT, DELETE or HEAD in forms. I
would like to "overload" POST for this. Would the proper way to do
this in Web2PY be something like this:
form=FORM(INPUT(_name="REST_formt", my_REST_method = "PUT",
requires=IS_NOT_EMPTY() )

Thanks

mdipierro

unread,
Jan 7, 2008, 9:30:21 PM1/7/08
to Gluon Web Framework
Not sure. I do not know REST. If you send me an example of the form
(or the page) you would like to generate I will tell you how to do it.
web2py does not restrict you to use HTML 4.


Tim Gebhardt

unread,
Jan 7, 2008, 11:05:36 PM1/7/08
to gl...@googlegroups.com
REST isn't so much isn't something that can be expressed easily with a few examples, but it's a philosophy on how to make service oriented architecture or distributed system.  The Wikipedia article on REST has a pretty good overview:

http://en.wikipedia.org/wiki/Representational_State_Transfer

The biggest obstacle for implementing REST in a web framework is the templating engine and the full support for all HTTP verbs (GET, POST, PUT, DELETE).  Certain templating engines assume all the dynamic content you want to serve is HTML.  It's a little difficult to do some RESTful things when this is the case.  Some web frameworks or HTTP libraries don't support all the HTTP verbs (usually DELETE is the problem, which people couldn't figure out how to use it until RESTful web services started to appear).

-Tim Gebhardt
t...@gebhardtcomputing.com

voltron

unread,
Jan 8, 2008, 4:52:50 AM1/8/08
to Gluon Web Framework
I have no examples yet because I am not sure how I would do it in
Web2PY. For comparison, here is one way that Pylons takes care of this
issue:

http://pylonshq.com/docs/0.9/module-pylons.decorators.rest.html


Thanks

Massimo Di Pierro

unread,
Jan 8, 2008, 8:52:32 AM1/8/08
to gl...@googlegroups.com
The web2py template system does not assume HTML so that should not be a roblem. Whether it acepts PUT and DELETE HTTP requests I do not know. web2py uses paste httpserver so it does it paste does it. 

Massimo Di Pierro

unread,
Jan 8, 2008, 9:02:21 AM1/8/08
to gl...@googlegroups.com
If pylons does it, web2py can do it (they both reply on paste).
Tim, is you manage to write functional example please share it with the list.

Massimo

On Jan 7, 2008, at 10:05 PM, Tim Gebhardt wrote:

Reply all
Reply to author
Forward
0 new messages