If you want to use GET and POST for the same purpose set them equal to each
other as Chris demonstrated. This is not ideal.
There is a spoon, ahem POST. There is also support for HEAD and DELETE
afaik. Following is an example using memcache as a simple key/value store.
The idea is to use GET to read the collection and POST to write to it.
paths = ('/', 'Foo')
app = web.application(paths, globals())
db = memcache.Client(['127.0.0.1:11212'])
db.set('foo', '0')
class Foo:
def GET(self):
return db.get('foo')
def POST(self):
db.incr('foo') # increment foo
raise web.seeother('/')
*GET=0, GET=0, GET=0, POST~>GET=1, GET=1, POST~>GET=2*
Let me know if that helps.
On Sat, Nov 7, 2009 at 7:10 AM, geekbuntu <[email protected]> wrote:
>
> so there is no spoon - i mean POST?
> there is only GET(?)
>
> On Oct 31, 9:27 am, Chris Brannon <[email protected]> wrote:
> > xrfang <[email protected]> wrote:
> > > But one small issue on webpy side: while it is clear to use a GET and
> > > a POST method, what if I would like to use one method to handle either
> > > POST or GET?
> >
> > class foo_handler:
> > def GET(self):
> > # do whatever
> >
> > POST = GET
> >
> > -- Chris
> >
>
--
Angelo Gladding
[email protected]
http://angelo.gladding.name/
E69E 47E8 5C3A 96E5 C70F
D931 F35C ACBA 6F39 9611
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---