[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread João Matos
Thanks, but I can't do that, because the controller is used for the grid and several other functions (onvalidation, ondelete, etc.). Besides, "locking" a record for the entire time a user is looking at it isn't a good practice. Until I found/learn a better solution with web2py, I'm using an old

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread Leonel Câmara
That's weird. It seems looking at the adapter in pydal, sqlite does not start a transaction after connection like most adapters. Reading the sqlite documentation, that's probably because sqlite starts a transaction automatically as soon as anything writes to the database. So, basically, you

[web2py] Re: Is it possible to run a Python script when starting web2py, without the shell option?

2019-03-21 Thread João Matos
That worked like a charm. Thanks. quinta-feira, 21 de Março de 2019 às 22:25:24 UTC, Leonel Câmara escreveu: > > It's possible to use an options.py file to setup the parameters of the > windows service. > > See > http://www.web2py.com/AlterEgo/default/show/77 > > Since it's just python you can us

[web2py] Is it possible to pass a grid's row modified_on field to and auto created edit form?

2019-03-21 Thread João Matos
Hello, Is it possible to pass a record modified_on field to and auto created edit form from a grid? Can I use editargs to do that? Something like editargs={'modified_on': row.modified_on}? I need to check if the record changed when the user tries to save the edited record in the auto created e

[web2py] Re: Is it possible to run a Python script when starting web2py, without the shell option?

2019-03-21 Thread Leonel Câmara
It's possible to use an options.py file to setup the parameters of the windows service. See http://www.web2py.com/AlterEgo/default/show/77 Since it's just python you can use options.py to run your script -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread João Matos
Maybe I'm not explaining myself correctly. I tested and it isn't working the way I need and explained. My test was: I put a sleep(10) between step 1 and 2. On another session I changed the record in question. Checked the changed was done. Waited for the sleep to end and then step 2 wrote over th

[web2py] Re: Is it possible to run a Python script when starting web2py, without the shell option?

2019-03-21 Thread João Matos
I run web2py as a Windows Service. And I want that when the service starts (and only then) a Python script deletes a control file inside c:\web2py. I saw the -R command line option, but that only works with a web2py shell. What I need is something similar to Python's env var PYTHONSTARTUP. quin

[web2py] Re: Is it possible to run a Python script when starting web2py, without the shell option?

2019-03-21 Thread Leonel Câmara
What does it even mean run only once when web2py starts? Web2py can be running in multiple processes and in multiple threads. The answer totally depends on what you're trying to do and how you run web2py. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github

[web2py] Is it possible to run a Python script when starting web2py, without the shell option?

2019-03-21 Thread João Matos
Hello, Is it possible to run a Python script when starting web2py, without the shell option? What the script does can't be in the models or controllers. I need it to only run once per web2py start. Thanks, JM -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http:/

[web2py] Re: How to catch index error

2019-03-21 Thread Dave S
On Tuesday, March 19, 2019 at 5:45:42 PM UTC-7, Leonel Câmara wrote: > > Notice that, it seems you are using [-1] because > I thought he was doing that to test our ability to count brackets, braces, and parens. (GG's default font, as used on my screen, makes them very close in appearance; us

[web2py] Does SQLFORM.grid comply with detect_record_change in the new/edit auto-created forms?

2019-03-21 Thread João Matos
Hello, Does SQLFORM.grid comply with detect_record_change in the new/edit auto-created forms? http: //web2py.com/books/default/chapter/29/07/forms-and-validators#Detect-record-change Thanks, JM -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread João Matos
@Anthony If I try for_update=True in the 1st SELECT I get this error sqlite3.OperationalError: near "FOR": syntax error. My original code row = db.wo_counter(year_=request.now.year) My interpretation of your suggestion row = db(db.wo_counter.year_ == request.now.year).select( db.wo_counter.ye

[web2py] import Requests Error

2019-03-21 Thread greenpoise
This used to work for me: import requests import requests.auth Not anymore. I was working on OAuth2.0 Thanks -- 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 Iss

[web2py] Re: Sharing Auth

2019-03-21 Thread Anthony
I think #3 should work -- see https://groups.google.com/d/msg/web2py/x0xCBAkLWzk/rtpysPZCcE0J. On Thursday, March 21, 2019 at 9:50:54 AM UTC-4, zm wrote: > > I'm trying to determine the best approach to an issue, and would > appreciate feedback. > > In an enterprise environment with multiple web

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread Anthony
On Wednesday, March 20, 2019 at 9:56:11 PM UTC-4, João Matos wrote: > > What I read about the commit/rollback "wrapping" that web2py does, it > doesn't seem to solve my problem. > > Let me explain. > I have 3 tables (sn_counter, wo_counter and wo). > The procedure I must do is the following: > 1.

[web2py] Re: How to create a nested json dictionary by loading data from a flat, parent-referencing list?

2019-03-21 Thread Alex Glaros
Works like a charm, thanks so much! -- 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 Gro

[web2py] Re: How to create a nested json dictionary by loading data from a flat, parent-referencing list?

2019-03-21 Thread Leonel Câmara
The brackets are there because it's a list of roots in your tree, if you know for sure that you will have always one and only one root, you can do: {{response.write(json(your_tree[0]), escape=False)}} -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com

[web2py] Re: How to create a nested json dictionary by loading data from a flat, parent-referencing list?

2019-03-21 Thread Alex Glaros
It kind of works but adds a an opening and closing bracket "[" that surrounds the whole data like this: var datascource = [{"id": 2, "name": "Fred", all the rest of the data for the whole process}]; If I paste the json directly into the JavaScript function and manually delete the surrou

[web2py] Sharing Auth

2019-03-21 Thread zm
I'm trying to determine the best approach to an issue, and would appreciate feedback. In an enterprise environment with multiple web2py applications, we need a way to manage users / groups. We utilize AD for authentication, and in operating in Python2.7 we are able to use AD and retrieve AD gr

[web2py] Trello Roadmap

2019-03-21 Thread zm
Is it a fair assumption that the trello roadmap at https://trello.com/b/d3aqBbBl/web2py-roadmap is no longer in use? It hasn't been updated since 2016. Can the link in http://web2py.com/init/default/documentation be removed or updated to a new roadmap? -- Resources: - http://web2py.com - h

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread Leonel Câmara
The transaction is atomic, that means there's nothing happening in the middle. Your use case is fine. Of course, that if you give the user a form, while he's editing it, the form can be changed by others as well, in that case you need to add your own locking or check the record for modifications

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread João Matos
Yes, I know. See the steps I mentioned on my previous message. >From web2py's perspective (if I'm not mistaken) is like this: 0. Enter function (activate web2py "transaction"). My steps go in the middle. 6. Commit "transaction". If anyone changes the record from wo_counter or sn_counter in the mi

[web2py] Re: How to create a nested json dictionary by loading data from a flat, parent-referencing list?

2019-03-21 Thread Leonel Câmara
You can simply do in a view: {{from gluon.serializers import json}} Then where you want it in the view: {{response.write(json(your_tree), escape=False)}} -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.go

[web2py] Re: IS_IN_SET instead of IS_IN_DB

2019-03-21 Thread Leonel Câmara
IS_IN_DB has a label keyword argument, the label can be a string template or a function. You can make a function that given a value gives you the label (getting it from the other table) and use it in IS_IN_DB. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://g

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-21 Thread Leonel Câmara
It does. A transaction is an atomic operation. https://www.geeksforgeeks.org/acid-properties-in-dbms/ -- 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

[web2py] IS_IN_SET instead of IS_IN_DB

2019-03-21 Thread 'Annet' via web2py-users
I needed a IS_IN_DB() validator based on joined tables with the id coming from one table and the label coming from both tables, since I did not get this to work I tried: table.labelIDs.requires = IS_EMPTY_OR(IS_IN_SET([(r.ntw_edge_label_set.id, '%s' %str(r.vtx_vertex.name + ' - ' + r.ntw_edge_