[web2py] Routes.py and function similar to Auth tripping me up

2016-10-07 Thread Joe Barnhart
I created some "widgets" (for lack of a more descriptive name) using the same pattern as the Auth object. When you call it, it returns a special function that can respond to several different "sub-functions". This has been tremendously handy but now I'm encountering a problem -- when I uses

[web2py] pair small bugs

2016-10-07 Thread Val K
1. Trying to change 'notnull' of field that is *'reference ...'* hasn't any effect at DB-level, i.e. you can set 'notnull' (False or True) only once, migrate doesn't do the job - no error and no effect 2. Trying to change 'notnull' of *any* field of table with *rname* causes an error,

[web2py] Re: validate_and_insert() doesn't work for compute field

2016-10-07 Thread Anthony
And the bug has now been fixed in master. Anthony On Friday, October 7, 2016 at 3:35:29 PM UTC-4, Yang wrote: > > Yes this works, Thanks! > > On Friday, October 7, 2016 at 4:40:02 PM UTC+2, Anthony wrote: >> >> FYI, for now you should be able to resolve the problem by explicitly >> specifying

[web2py] Re: read a field of auth_user

2016-10-07 Thread Aydin
Thanks Anthony, Absolutely worked fine. On Friday, October 7, 2016 at 10:35:33 AM UTC-4, Anthony wrote: > > On Friday, October 7, 2016 at 9:48:45 AM UTC-4, Aydin wrote: >> >> Thanks, information = auth.user.newfield worked as expected. >> I just want to mentioned when I used >> rows =

[web2py] Re: read a field of auth_user

2016-10-07 Thread Aydin
The first one worked:information = auth.user.newfield The second did not:rows = db(db.auth_user.id==auth.user.id ).select(db.auth_user.newfield) On Friday, October 7, 2016 at 9:51:15 AM UTC-4, Marlysson Silva wrote: > > Don't worked? > > Em sexta-feira, 7 de outubro de 2016 10:48:45 UTC-3, Aydin

[web2py] Login Error not loading when using username

2016-10-07 Thread webmaster
I used this slice to enable usernames for login: http://www.web2pyslices.com/slice/show/1642/login-with-username-and-email For some reason, a failed login doesn't give me an error, just reloads the page. And nothing seems to show up in auth().errors. I should mention I'm using version 2.12.2

[web2py] Re: validate_and_insert() doesn't work for compute field

2016-10-07 Thread Yang
Yes this works, Thanks! On Friday, October 7, 2016 at 4:40:02 PM UTC+2, Anthony wrote: > > FYI, for now you should be able to resolve the problem by explicitly > specifying your own "requires" attribute for the computed field (possibly > even just setting it to None). > > On Friday, October 7,

[web2py] Re: appadmin/ccache and dict in cache.disk

2016-10-07 Thread Niphlod
definitely a bug. a PR is on the way. On Friday, October 7, 2016 at 8:49:45 PM UTC+2, Niphlod wrote: > > ok, it's valid syntax. will investigate... > > On Friday, October 7, 2016 at 7:04:51 PM UTC+2, MDSIII wrote: >> >> cval = dict(request.vars) >> cval.update(request.vars) >> cache.ram('agent',

[web2py] Re: manual for loop in views and json

2016-10-07 Thread 黄祥
it's work as expected, thank you so much marlysson e.g. import gluon.contrib.simplejson def test(): chosen = request.args(0) query = (db.account.investor == chosen) rows = db(query).select(orderby = ~db.account.id) return gluon.contrib.simplejson.dumps([[r.product.name,

[web2py] Re: appadmin/ccache and dict in cache.disk

2016-10-07 Thread Niphlod
ok, it's valid syntax. will investigate... On Friday, October 7, 2016 at 7:04:51 PM UTC+2, MDSIII wrote: > > cval = dict(request.vars) > cval.update(request.vars) > cache.ram('agent', > lambda: cache.disk('agent', lambda :cval, time_expire = 0), > time_expire = 0) > > I realize

[web2py] Re: OT: rgraph question

2016-10-07 Thread Dave S
On Thursday, October 6, 2016 at 12:32:13 AM UTC-7, Dave S wrote: > > Does anyone here use RGraph? (rgraph.net) > > I'm doing a [fairly simple] line graph with it, and most things are > working, but not keys ... I've added the keys option (and I've looked > through the examples provided with

[web2py] Re: appadmin/ccache and dict in cache.disk

2016-10-07 Thread MDSIII
cval = dict(request.vars) cval.update(request.vars) cache.ram('agent', lambda: cache.disk('agent', lambda :cval, time_expire = 0), time_expire = 0) I realize this is sort of rediculous code but it shows all assignment operations to the object "cval" that happen before it is

Re: [web2py] Re: Detecting changes to auth_user record of logged in user.

2016-10-07 Thread Michael Ellis
Thanks, Anthony. That works nicely. On Fri, Oct 7, 2016 at 10:32 AM Anthony wrote: > Have you tried adding: > > auth.user.update(userlevel=newlevel) > > Anthony > > > On Thursday, October 6, 2016 at 6:15:02 PM UTC-4, Michael Ellis wrote: > > > I have the following code

[web2py] Re: validate_and_insert() doesn't work for compute field

2016-10-07 Thread Anthony
FYI, for now you should be able to resolve the problem by explicitly specifying your own "requires" attribute for the computed field (possibly even just setting it to None). On Friday, October 7, 2016 at 5:03:32 AM UTC-4, Yang wrote: > > OK, Thanks a lot! > -- Resources: - http://web2py.com

Re: [web2py] Re: Why isn't WEB2PY a part of Googles summer of code? Will it be this time?

2016-10-07 Thread Anthony
Maybe have a look at https://github.com/viniciusban/web2py.test. Anthony On Friday, October 7, 2016 at 2:46:17 AM UTC-4, Mathieu Clabaut wrote: > > Hello, > > I'm pondering to volunteer as a mentor for a pytest web2py framework, but > I'm a bit afraid of my low level of availability. > > What

[web2py] Re: read a field of auth_user

2016-10-07 Thread Anthony
On Friday, October 7, 2016 at 9:48:45 AM UTC-4, Aydin wrote: > > Thanks, information = auth.user.newfield worked as expected. > I just want to mentioned when I used > rows = db(db.auth_user.id==auth.user.id).select(db.auth_user.newfield) > it game me auth_user.newfielddata, data is the string

[web2py] Re: Detecting changes to auth_user record of logged in user.

2016-10-07 Thread Anthony
Have you tried adding: auth.user.update(userlevel=newlevel) Anthony On Thursday, October 6, 2016 at 6:15:02 PM UTC-4, Michael Ellis wrote: > > > I have the following code as a json service for changing user privileges. > This app doesn't need the fine-grained control of Web2py RBAC so

[web2py] Re: Detecting changes to auth_user record of logged in user.

2016-10-07 Thread Michael Ellis
Thanks, Marlysson. I understand why it's going wrong when the user changes their own level. My question was aimed a finding out if web2py had a convenience function to refresh auth.user from db.auth_user. Otherwise I have to use an ugly construct like: try: aid = auth.user.id #

[web2py] Re: SQLFORM list:string auto-fill on update

2016-10-07 Thread Marlysson Silva
Try this.. http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?#callbacks-on-record-insert-delete-and-update Generating by python and append field list and after commit the transaction. Em sexta-feira, 7 de outubro de 2016 10:39:04 UTC-3, Pierre escreveu: > > Hi, > > I

[web2py] Re: read a field of auth_user

2016-10-07 Thread Marlysson Silva
Don't worked? Em sexta-feira, 7 de outubro de 2016 10:48:45 UTC-3, Aydin escreveu: > > Thanks, information = auth.user.newfield worked as expected. > I just want to mentioned when I used > rows = db(db.auth_user.id==auth.user.id).select(db.auth_user.newfield) > it game me

[web2py] Re: read a field of auth_user

2016-10-07 Thread Aydin
Thanks, information = auth.user.newfield worked as expected. I just want to mentioned when I used rows = db(db.auth_user.id==auth.user.id).select(db.auth_user.newfield) it game me auth_user.newfielddata, data is the string stored in the newfield. On Friday, October 7, 2016 at 9:40:59 AM

[web2py] Re: manual for loop in views and json

2016-10-07 Thread Marlysson Silva
try json.load wrapper json.dumps with data. Em sexta-feira, 7 de outubro de 2016 10:34:38 UTC-3, 黄祥 escreveu: > > *anthony solution in stackoverflow that i adapt to my table is * > return json.dumps([[r.product.name, r.subscription_amount] for r in rows] > ) > > *reproduce* > "[[\"Dana

[web2py] Re: read a field of auth_user

2016-10-07 Thread Marlysson Silva
Try: information = auth.user.newfield The auth.user contains a copy of auth_user table from current logged in user. Or: rows = db(db.auth_user.id==auth.user.id).select(db.auth_user.newfield) Em sexta-feira, 7 de outubro de 2016 10:00:51 UTC-3, Aydin escreveu: > > This is a simple question

[web2py] Re: read a field of auth_user

2016-10-07 Thread Marlysson Silva
Try: information = auth.user.newfield The auth.user contains a copy of auth_user table from current logged in user. Em sexta-feira, 7 de outubro de 2016 10:30:36 UTC-3, Aydin escreveu: > > I tried rows = db().select(db.auth_user.id==auth.user.id).newfield but it > did not work > > On Friday,

[web2py] SQLFORM list:string auto-fill on update

2016-10-07 Thread Pierre
Hi, I need to fill a list:string field sqlform with new random values on update (that is replace record values automatically). Is this possible ? it's for a test. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: read a field of auth_user

2016-10-07 Thread 黄祥
sorry my bad, forgot to insert the query on my code before query = (db.auth_user.id == auth.user_id) rows = db(*query*).select(db.auth_user.ALL) for row in rows: print row.newfield if you want to explicit the field : query = (db.auth_user.id == auth.user_id) rows =

[web2py] Re: manual for loop in views and json

2016-10-07 Thread 黄祥
*anthony solution in stackoverflow that i adapt to my table is * return json.dumps([[r.product.name, r.subscription_amount] for r in rows] ) *reproduce* "[[\"Dana Ekuitas\", 1.0], [\"Dana Likuid\", 2.0], [\"Dana Lancar\", 3.0]]" *format that i want to have* [['Dana Ekuitas', 1.0 ], ['Dana

[web2py] Re: read a field of auth_user

2016-10-07 Thread Aydin
I tried rows = db().select(db.auth_user.id==auth.user.id).newfield but it did not work On Friday, October 7, 2016 at 9:24:21 AM UTC-4, Aydin wrote: > > Thanks, > > I do not want to read the newfield for all auth users but only for the > current auth user. > > On Friday, October 7, 2016 at

[web2py] Re: read a field of auth_user

2016-10-07 Thread 黄祥
hm, not sure what do you mean with current auth user, is it current user login, if it yes, then you probably can try add the query for that e.g. query = (db.auth_user.id == auth.user_id) rows = db().select(db.auth_user.ALL) for row in rows: print row.newfield if you want to explicit the field :

[web2py] Re: manual for loop in views and json

2016-10-07 Thread Marlysson Silva
What string returned by : [[r.product.name, r.subscription_amount] for r in rows] ? Em sexta-feira, 7 de outubro de 2016 10:24:25 UTC-3, Marlysson Silva escreveu: > > How are your database modeling.. > You are retrieving r.product.name but don't are in this row returned.. :/ > . > > Em

[web2py] Re: manual for loop in views and json

2016-10-07 Thread Marlysson Silva
How are your database modeling.. You are retrieving r.product.name but don't are in this row returned.. :/ . Em sexta-feira, 7 de outubro de 2016 10:16:17 UTC-3, 黄祥 escreveu: > > *the code* > @service.json > def my_data(): > query = (db.account.investor == 1) > rows =

[web2py] Re: read a field of auth_user

2016-10-07 Thread Aydin
Thanks, I do not want to read the newfield for all auth users but only for the current auth user. On Friday, October 7, 2016 at 9:05:39 AM UTC-4, 黄祥 wrote: > > pls try: > rows = db().select(db.auth_user.ALL) > for row in rows: > print row.newfield > > if you want to explicit it : > rows =

[web2py] Re: manual for loop in views and json

2016-10-07 Thread 黄祥
*the code* @service.json def my_data(): query = (db.account.investor == 1) rows = db(query).select(db.account.product.name, db.account.subscription_amount, orderby = ~db.account.id).as_list() return response.json(rows) *reproduce* [{"account": {"subscription_amount": 3.0}, "_extra":

[web2py] Re: manual for loop in views and json

2016-10-07 Thread Marlysson Silva
You get data from pydal ( web2py ) ( each field in select ) , after transform in list using as_list and after return a response.json using a rows transformed in list. Em sexta-feira, 7 de outubro de 2016 10:04:31 UTC-3, Marlysson Silva escreveu: > > In web2py have how you get each fields, at

[web2py] Re: read a field of auth_user

2016-10-07 Thread 黄祥
pls try: rows = db().select(db.auth_user.ALL) for row in rows: print row.newfield if you want to explicit it : rows = db().select(db.auth_user.first_name, db.auth_user.last_name, db.auth_user.newfield) for row in rows: print row.newfield ref :

[web2py] Re: manual for loop in views and json

2016-10-07 Thread Marlysson Silva
In web2py have how you get each fields, at moment that you recover the data, stop here, and adding as_list() , most linkely will return all list as list: rows = db(query).select(db.account.product.name, db.account. subscription_amount, orderby = ~db.account.id).as_list() And return this result

[web2py] read a field of auth_user

2016-10-07 Thread Aydin
This is a simple question but I couldn't find the answer for it. How can I read a custom field in the auth_user? I have added a new field to auth_user table by: auth.settings.extra_fields['auth_user']= [ Field('newfield','string') ] now I want to read that value in the controller using

[web2py] Re: manual for loop in views and json

2016-10-07 Thread 黄祥
thanks for your hints, Marlysson, but the format is not same like highcharts needs *format needed :* data: *[ * * ['Dana Ekuitas', 1.0 ],* * ['Dana Likuid', 2.0 ],* * ['Dana Lancar', 3.0 ],* *]* *my code :controllers/default.py* @service.json def my_data(): query = (db.account.investor ==

Re: [web2py] Re: Why isn't WEB2PY a part of Googles summer of code? Will it be this time?

2016-10-07 Thread Marlysson Silva
great if you give to do for me ok .. Em sexta-feira, 7 de outubro de 2016 09:28:43 UTC-3, Mathieu Clabaut escreveu: > > Not for now. > My intention was to put it on github, but it needs to be separated from my > actual application code which I can not open source (for now). > For the moment, I

Re: [web2py] Re: Why isn't WEB2PY a part of Googles summer of code? Will it be this time?

2016-10-07 Thread Mathieu Clabaut
Not for now. My intention was to put it on github, but it needs to be separated from my actual application code which I can not open source (for now). For the moment, I have three directories (test_unit, test, test_ui) with a conftest.py in each allowing to use py.test on those directories. For

[web2py] Re: Detecting changes to auth_user record of logged in user.

2016-10-07 Thread Marlysson Silva
Isn't because you are putting the level user hardcoded? There after that user change own level , the verification don't works more. 1. If you want that user name are unique mark at table the field with validator unique=True 2. The size of rows returned could be made with count() ,

[web2py] Re: manual for loop in views and json

2016-10-07 Thread Marlysson Silva
Try this: 1. Using service: @service.json def my_data(): your_data = your_query.as_dict() return response.json(you_data) 2. At view call: http://127.0.0.1/test/default/my_data 3. Most likely it's to return a dictionary with data,if it works then you call via getJson. Em

Re: [web2py] Re: Why isn't WEB2PY a part of Googles summer of code? Will it be this time?

2016-10-07 Thread Marlysson Silva
I'm want know how you build this enviroment to tests with web2py.. in three layers .. Are your project in github? Em sexta-feira, 7 de outubro de 2016 03:46:17 UTC-3, Mathieu Clabaut escreveu: > > Hello, > > I'm pondering to volunteer as a mentor for a pytest web2py framework, but > I'm a bit

[web2py] Re: appadmin/ccache and dict in cache.disk

2016-10-07 Thread Niphlod
how do you store a dict in cache.disk ? On Friday, October 7, 2016 at 8:59:34 AM UTC+2, MDSIII wrote: > > When I store a dict in cache.disk and then request > /appadmin/ccache I'm getting a key error: > > Traceback (most recent call last): > File "C:\repos\TCL\web2py\gluon\restricted.py", line

[web2py] Re: validate_and_insert() doesn't work for compute field

2016-10-07 Thread Yang
OK, Thanks a lot! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups

[web2py] manual for loop in views and json

2016-10-07 Thread 黄祥
let say i have a code with web2py in highchart, when i tried to convert it data using json, it's not work *previous code works well using python in views manually * *views/templates/chart_pie.html* series: [{ type: 'pie', name: '{{=T('Subscription') }}

[web2py] appadmin/ccache and dict in cache.disk

2016-10-07 Thread MDSIII
When I store a dict in cache.disk and then request /appadmin/ccache I'm getting a key error: Traceback (most recent call last): File "C:\repos\TCL\web2py\gluon\restricted.py", line 227, in restricted exec ccode in environment File

Re: [web2py] Re: Why isn't WEB2PY a part of Googles summer of code? Will it be this time?

2016-10-07 Thread Mathieu Clabaut
Hello, I'm pondering to volunteer as a mentor for a pytest web2py framework, but I'm a bit afraid of my low level of availability. What I a have in mind is a pytest plugin to allow three level of testing : 1. unit testing (with or without view rendering), 2. fast WebClient level testing