Re: [web2py] Re: Auto-generate PUT and DELETE methods

2020-08-24 Thread AGRogers
Hi Rahul I haven't done much at all with the rest api. But I would have assumed that you would need to decorate it with @requires to control who can access what. I can't see that in your code. On Tue, 25 Aug 2020, 3:06 am Rahul, wrote: > Hi All, >Not sure if this is the right threa

[web2py] Re: Auto-generate PUT and DELETE methods

2020-08-24 Thread Rahul
Hi All, Not sure if this is the right thread to put this up -- I was trying to use this code for rest/json -- however -- with slight changes and wrong parameters in the URL my entire table got exposed -- Here is the code -- *CONTROLLER : DEFAULT.PY CODE* ## API --- @request.restfu

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-22 Thread Massimo Di Pierro
wow. done that. On Thursday, 21 June 2012 18:04:04 UTC-5, Anthony wrote: > > Using my new Google Groups super > powers, > I have edited your original post, so if you'd like, you can delete this > correction and we can pretend this

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-21 Thread Anthony
Using my new Google Groups super powers, I have edited your original post, so if you'd like, you can delete this correction and we can pretend this never happened. ;-) Anthony On Thursday, June 21, 2012 6:40:37 PM UTC-4, Massimo

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-21 Thread Massimo Di Pierro
Silly me. This def PUT(table_name,record_id): return db(db[table_name]._id==record_id).delete() was supposed to be def DELETE(table_name,record_id): return db(db[table_name]._id==record_id).delete() On Thursday, 21 June 2012 13:38:01 UTC-5, Derek wrote: > > Looks like you have Get, Post, a

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-21 Thread Derek
Looks like you have Get, Post, and PUT and PUT. Where's Delete? On Wednesday, June 20, 2012 4:39:33 PM UTC-7, Massimo Di Pierro wrote: > > You can do > > @request.restful() > def api(): > response.view = 'generic.'+request.extension > def GET(*args,**vars): > patterns = 'auto' >

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-20 Thread Osama Hussain
Thanks a LOT! I know we should avoid auto pattern generation but having this functionality makes it super easy to rapidly develop a back end so that I could focus on my front end and have a prototype shipped in time, guess I made the right choice to choose web2py :) On Thursday, June 21, 2012

Re: [web2py] Re: Auto-generate PUT and DELETE methods

2012-06-20 Thread Bruno Rocha
I am startiing to develop an mobile app for a website using movu.ca ( http://www.menuvegano.com.br), the idea is that the users will be able to post cook recipes and its pictures via the mobile using the api. For the mobile app I am using tiggzi.com and it is rest based. Everything works, but upl

Re: [web2py] Re: Auto-generate PUT and DELETE methods

2012-06-20 Thread Massimo Di Pierro
The code I posted would not work... It depends on how it is uploaded. if you have the code curl -X POST \ -H "Content-Type: text/plain" \ -T 'hello.txt' \ http://127.0.0.1:8000/app/default/upload1/hello.txt I think you can do def upload(): table = db.tablename record = db.tabl

Re: [web2py] Re: Auto-generate PUT and DELETE methods

2012-06-20 Thread Bruno Rocha
How would it be to receive a file upload thought the restful api? On Wed, Jun 20, 2012 at 8:39 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > You can do > > @request.restful() > def api(): > response.view = 'generic.'+request.extension > > def GET(*args,**vars): > >

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-20 Thread Massimo Di Pierro
You can do @request.restful() def api(): response.view = 'generic.'+request.extension def GET(*args,**vars): patterns = 'auto' parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else:

[web2py] Re: Auto-generate PUT and DELETE methods

2012-06-20 Thread howesc
i suspect that in your case PUT and DELETE would look a lot like POST. not sure the exact code for your use case, but i know it's possible to have PUT and DELETE methods. On Wednesday, June 20, 2012 9:30:26 AM UTC-7, Osama Hussain wrote: > > Using the following code web2py generated all possibl