[web2py] Re: Invalid field name although rname is set

2016-11-11 Thread Niphlod
update() is a methodyou can't use a model that has a field that is named "update". It's true that you're using rname, but the problem is that you need to choose a less "funny" name for the field name, not the rname. On Friday, November 11, 2016 at 7:40:32 AM UTC+1, Edwin Haver wrote

Re: [web2py] scheduling multiple tasks

2016-11-11 Thread Vid Ogris
Ok thanx How and where do I add one time controller, or application start? my task will be executed once per hour 2016-11-11 7:18 GMT+01:00 Nico de Groot : > Looking at your code you posted earlier at http://stackoverflow.com/ > questions/34661782/web2py-function-not-triggered-on- > user-reques

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Mike Stephenson
Hi Dave. for example how do I read the json from this link: https://biglibrary.pythonanywhere.com/app/phonegap/temp.json A code snippet will be of much help. Thanks. :) On Friday, November 11, 2016 at 12:34:26 AM UTC+5:30, Dave S wrote: > > > > On Wednesday, November 9, 2016 at 9:24:02 PM UTC-8,

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Marlysson Silva
To use a conditions based in values use: @auth.require(conditions) http://web2py.com/books/default/chapter/29/09/access-control#Combining-requirements And to use many values in conditions I guess that this solved your problem: role_names = ["admin","supervisor","auditor"] @auth_requires(any( au

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Marlysson Silva
To use a conditions based in values use: @auth.require(conditions) http://web2py.com/books/default/chapter/29/09/access-control#Combining-requirements And to use many values in conditions I guess that this solve your problem: role_names = ["admin","supervisor","auditor"] @auth_requires(any( aut

[web2py] Re: scheduling multiple tasks

2016-11-11 Thread 黄祥
pls try : (you can improve it to another queue task by define another function in controller) *controllers/default.py* """ for running scheduler python web2py.py --nogui --no-banner -K woshiweb -D 0 1 hour = 3600 seconds # for period 10 minutes = 600 seconds # for timeout """ start_now = datetim

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread 黄祥
i'm interested in *ANY* and *ALL* in your code, but can't find anything that contain *ANY* or *ALL* on the link you provide, is it DAL, web2py or python syntax? best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (So

Re: [web2py] Re: scheduling multiple tasks

2016-11-11 Thread Vid Ogris
The runWoshiEngine is started on user request. I have to get another one working like every hour after the app was started. Call it saveIdOut in scheduler.py from gluon.scheduler import Scheduler def runWoshiEngine(scriptId, path): # import os, sys # import time import subprocess

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Niphlod
any and all are definitely python syntax. I do this using the cached groups, so I don't reach the db for every check ALLOWED = set(('admin', 'contributor')) @auth.requires(lambda: auth.user_id and ALLOWED & set(auth.user_groups. values())) On Friday, November 11, 2016 at 1:55:25 PM UTC+1, 黄祥

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Marlysson Silva
It's a python code .Built-in functions. The link that I provided it to combine requirements in web2py permission level. References: ALL https://docs.python.org/2/library/functions.html#all ANY https://docs.python.org/2/library/functions.html#any The ANY and ALL using a iterable to verify your v

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Marlysson Silva
It's a python code .Built-in functions. The link that I provided it to combine requirements in web2py permission level. References: ALL https://docs.python.org/2/library/functions.html#all ANY https://docs.python.org/2/library/functions.html#any The ANY and ALL using a iterable to verify your v

[web2py] Re: Invalid field name although rname is set

2016-11-11 Thread Anthony
Field names cannot be Python keywords or attribute names of the Table object, even if using rname. The Table class inherits from pydal.helpers.classes.BasicStorage, which has methods "update", "get", "keys", "values", etc. -- so none of those will work as field names. Anthony On Friday, Novemb

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Anthony
On Friday, November 11, 2016 at 7:29:06 AM UTC-5, Mike Stephenson wrote: > > Hi Dave. for example how do I read the json from this link: > https://biglibrary.pythonanywhere.com/app/phonegap/temp.json > If you have that as a string in Python and want to convert it to a Python object (i.e., a dict

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread 黄祥
thanks all for the detail explanation, learn a lot new things today {{=DIV(auth.user_groups) }} *result :* {1L: 'Admin', 2L: 'User'} {{=DIV(auth.user_groups.values() ) }} *result :* AdminUser {{=set(auth.user_groups.values() ) }} *result :* set(['Admin', 'User']) now about hitting database, just

[web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Marlysson Silva
Likely because when user log in system , is created a object AUTH that contains all informations about current user logged , at login action happen all operations necessary to get user data of database ( including groups informations related ) Then with all this data in "session" don't need ve

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Richard Vézina
Simone, I don't understand why you say you cached groups, from what you showed you only prevent accessing db until the very end with the lambda no? Richard On Fri, Nov 11, 2016 at 8:16 AM, Niphlod wrote: > any and all are definitely python syntax. > > I do this using the cached groups, so I do

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Niphlod
every time you invoke has_membership you ask web2py to verify if in that instance the user belongs to a particular group. It translates to 1 or more queries to the backend. "my" method instead looks into the groups stored in the session (fetched only once at login), so it doesn't need the roundt

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Niphlod
and yes, using a lambda makes that piece of code execute only when that decorated function is called rather than every time the controller is hit. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread António Ramos
Great discussion. This should be prommoted to a "tips and trick with auth..." somewhere... 2016-11-11 16:07 GMT+00:00 Niphlod : > and yes, using a lambda makes that piece of code execute only when that > decorated function is called rather than every time the controller is hit. > > -- > Resources

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Mike Stephenson
Not that. Using javascript only how do I parse the json fron this link: https://biglibrary.pythonanywhere.com/app/phonegap/temp.json On Frida

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Leonel Câmara
$.getJSON("https://biglibrary.pythonanywhere.com/app/phonegap/temp.json ").then(function(data) { alert(data.message); }); Note that you m

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Mike Stephenson
Yeah exactly that doesn't work. How do I avoid that error? It says:" XMLHttpRequest cannot load https://biglibrary.pythonanywhere.com/app/phonegap/temp.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access." when I use

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Richard Vézina
Thanks to clarify I forgot about has_membership() vs auth.user_groups()... And yes I get tricked by auth.user_groups() sometimes ago for that very reason (update only at login)... Richard On Fri, Nov 11, 2016 at 11:32 AM, António Ramos wrote: > Great discussion. > This should be prommoted to a

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Anthony
On Friday, November 11, 2016 at 1:15:58 PM UTC-5, Mike Stephenson wrote: > > Yeah exactly that doesn't work. How do I avoid that error? It says:" > XMLHttpRequest cannot load > https://biglibrary.pythonanywhere.com/app/phonegap/temp.json. No > 'Access-Control-Allow-Origin' header is present on t

[web2py] Re: I am unable to parse contents from a json view in javascript? How do I do it?

2016-11-11 Thread Leonel Câmara
Seems like you're trying to make a phonegap/cordova app, the easiest way to go around the CORS problem is to simply put the web version of your app inside web2py's static folder. As a packaged application on your phone you will not have this problem. -- Resources: - http://web2py.com - http://

Re: [web2py] scheduling multiple tasks

2016-11-11 Thread Dave S
On Friday, November 11, 2016 at 4:15:46 AM UTC-8, Yebach wrote: > > Ok thanx > > How and where do I add one time controller, or application start? > my task will be executed once per hour > > Was the example I pointed not clear? What questions did you have after reading it? What could I expla

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread 黄祥
i assume the same thing goes to auth.user vs auth.is_logged_in(), auth.user faster than auth.is_logged_in() because auth.user didn't hit the database, isnt it? anything else how to prevent or avoid database access? *e.g.* *models/menu.py* if auth.user: """ # 1 result: """ """ # 2 if auth.is_lo

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-11 Thread Anthony
On Friday, November 11, 2016 at 4:15:50 PM UTC-5, 黄祥 wrote: > > i assume the same thing goes to auth.user vs auth.is_logged_in(), > auth.user faster than auth.is_logged_in() because auth.user didn't hit the > database, isnt it? > No, login status is maintained in the session -- auth.is_logged_in

[web2py] need to kill user sessions, not only block

2016-11-11 Thread Ty oc
So blocked or disabled have the same behaviour, what happend if I want to log out all the sessions from a specific user? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Rep

[web2py] Re: Invalid field name although rname is set

2016-11-11 Thread Edwin Haver
Thank you for the explanation. The error message is a bit misleading in this respect. On Friday, November 11, 2016 at 5:30:09 PM UTC+4, Anthony wrote: > > Field names cannot be Python keywords or attribute names of the Table > object, even if using rname. The Table class inherits from > pydal.h

[web2py] Re: DAL with db2 on ISeries/OS400 table names converted to AUTH_0000x

2016-11-11 Thread Massimo Di Pierro
You can use auth.settings.update( table_user_name='auth_user', table_group_name='auth_group', table_membership_name='auth_membership', table_permission_name='auth_permission', table_event_name='auth_event', table_cas_name='auth_cas', table_to

[web2py] Re: Memory leak in standalone DAL

2016-11-11 Thread Massimo Di Pierro
I understand this was fixed here: https://github.com/web2py/pydal/releases/tag/v16.11 On Tuesday, 8 November 2016 15:07:37 UTC-6, Sukhmeet Toor wrote: > > Hi Massimo, > > Thanks for looking into this. I just ran a few tests and I can confirm > that the leak does repro on Mac OS X El Capitan (10.

[web2py] Updating with Count

2016-11-11 Thread Anthony Smith
Hi all, I am at a lose of how to update a table with the row count form another table, I have been able to count and create a new form , which updates the other table . But I am hoping it is possible to be for the update to be automatic when changes are made to the 1st table . Below is a sho