[web2py] Re: RESTful request args/vars with JSON array

2014-10-24 Thread Henry Nguyen
3:01:23 AM UTC+2, Henry Nguyen wrote: >> >> Niphlod, >> >> That does not appear to be the case, either for request.restful() >> requests or regular controller requests. For example, consider this >> controller method: >> >> def test():

[web2py] Re: RESTful request args/vars with JSON array

2014-10-23 Thread Henry Nguyen
o store the array value, no? Henry On Thursday, October 23, 2014 7:16:00 AM UTC-7, Niphlod wrote: > > if the content-type of the POST request is application/json, "mylist" > would actually be yet parsed into request.post_vars (i.e. you can skip > body.read()) > > O

[web2py] Re: RESTful request args/vars with JSON array

2014-10-22 Thread Henry Nguyen
under request.body. Thanks for letting me know that request.restful() wouldn't parse it automatically, Niphlod. Henry On Monday, October 13, 2014 12:25:54 PM UTC-7, Niphlod wrote: > > you have to code your own methods. > > On Sunday, October 12, 2014 11:32:23 PM UTC+2, Henry Nguyen

[web2py] RESTful request args/vars with JSON array

2014-10-12 Thread Henry Nguyen
I have a function in my controller decorated with the @request.restful() decorator. I would like to be able to accept a JSON array of objects, [{"id": 1, "new_value": 1},{"id": 2, "new_value": 2}] , on a POST, PUT, or DELETE. For example, I'd like the client to be able to update a series of va

[web2py] Re: JSON response on auth.settings.on_failed_authentication with @request.restful()

2014-09-04 Thread Henry Nguyen
authorized.'))) return function(*args, **kwargs) return check_is_logged_in @request.restful() @requires_login def function(): ... Thanks again for the help, Leonel. Henry On Thursday, September 4, 2014 11:22:41 AM UTC-7, Henry Nguyen wrote: > > That is definitely a viable option..

[web2py] Re: JSON response on auth.settings.on_failed_authentication with @request.restful()

2014-09-04 Thread Henry Nguyen
That is definitely a viable option... not as clean as the decorator but certainly functional. Thank you Leonel :) Henry On Thursday, September 4, 2014 11:17:47 AM UTC-7, Leonel Câmara wrote: > > Ohh, in this case, instead of modifying tools.py I would drop the > auth.requires_login() decorator

[web2py] Re: JSON response on auth.settings.on_failed_authentication with @request.restful()

2014-09-04 Thread Henry Nguyen
Primarily because I would like to display custom messages sent from the API, and I want them controllable from the API side. Specifically, our UI framework has a feature built in which allows us to display custom messages from the API by specifying the message characteristics in the response bo

[web2py] JSON response on auth.settings.on_failed_authentication with @request.restful()

2014-09-04 Thread Henry Nguyen
I have a method decorated with the following decorators: @request.restful() @auth.requires_login() On an unauthenticated (non-logged-in) request, I get a 403 response with "Not authorized" in the response body, per default settings. I would like to be able to modify this response to be JSON. I

[web2py] Returning grid rows where is_active == False

2014-07-23 Thread Henry Nguyen
I'm using SQLFORM.grid() to display a list of users from db.auth_user for an administrative interface. I'd like to display deleted users as well as active users. Is there any way to modify SQLFORM.grid() to display rows where is_active == False in addition to where is_active == True? Using quer

[web2py] Re: id field is editable through REST PUT request

2014-04-16 Thread Henry Nguyen
> return db(tb._id==record_id).validate_and_update(**vars) > > ask for more details if needed. > > On Wednesday, April 16, 2014 8:15:42 PM UTC+2, Henry Nguyen wrote: >> >> Simply inserting into the tables blindly was the problem, as Massimo >> pointed out

[web2py] Re: id field is editable through REST PUT request

2014-04-16 Thread Henry Nguyen
. I could write an >>> inflammatory comment on a website, change the owner to someone else (via >>> the edit form) and then suddenly that other user is banned... >>> >>> On Wednesday, April 9, 2014 2:03:53 PM UTC-7, Massimo Di Pierro wrote: >>>> >

[web2py] Re: Querying a normalized DB

2014-04-12 Thread Henry Nguyen
ng is, with custom queries you could return just what you want > (structure-wise), but then you'll have problem parsing those results > because you can't know at query time what type of data a particular column > would be. I'd bet its an issue even with NOSQL backend, bu

[web2py] Querying a normalized DB

2014-04-11 Thread Henry Nguyen
I have a set of normalized "log" tables consisting of a single "log" table and multiple "x_log" tables where x is some different log type. The "log" table contains the data that is shared among all logs such as create_date. Each "x_log" table contains the data specific to that log type in additi

[web2py] id field is editable through REST PUT request

2014-04-08 Thread Henry Nguyen
Our product is using the @request.restful() decorator to specify REST endpoints for our resources. During testing, I noticed that I can specify a PUT request var of "id=x" where x is some new id and the id of that row will change to x. This is even WITH "db.table.id.writable = False." The PUT

[web2py] Re: Better to assign Auth permissions based on group membership or by individual auth user?

2013-12-16 Thread Henry Nguyen
requires_membership("buyers") > or explicitly > if auth.has_membership(role="buyers"): ... > > > On Monday, 16 December 2013 21:38:08 UTC-6, Henry Nguyen wrote: >> >> Hello, >> >> Our product has features which can be enabled o

[web2py] Better to assign Auth permissions based on group membership or by individual auth user?

2013-12-16 Thread Henry Nguyen
Hello, Our product has features which can be enabled or disabled depending on what the user has purchased. I would like to use the built-in Auth permissions functionality to achieve this effect. However, I'm not sure of what's the best way to proceed with its implementation. The two scenarios I

[web2py] Typo on Reference Manual Chapter 9 re: Restrictions on Registration

2013-12-09 Thread Henry Nguyen
The following is contained under the Reference Manual Chapter 9 under the Restrictions on Registration section: If you want to allow people to register and automatically log them in after > registration but still want to send an email for verification so that they > cannot login again after

Re: [web2py] URL Routing question re: setting persistent arguments for use in controller functions

2013-12-08 Thread Henry Nguyen
Pythonic this really is but it got the job done. Sessions will be much cleaner, though, so I'll go with that. Thank you again. On Sunday, December 8, 2013 9:28:16 AM UTC-8, Jonathan Lundell wrote: > > On 8 Dec 2013, at 8:43 AM, Jonathan Lundell > > wrote: > > On 8 Dec 2013, at 1

[web2py] URL Routing question re: setting persistent arguments for use in controller functions

2013-12-08 Thread Henry Nguyen
Hello, I have an application in which users can have sub_users. Within the app, a user can select a sub_user, at which point, all controls become targeted to that selected sub_user. For example, if I select sub_user 1 and then goto "settings/show_settings.html," I want the show_settings.html to