[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread Val K
I suppose modified_on field is readonly, so it is not post back along form submitting, but you can inject it using hidden attribute, that could be passed to the grid through editargs. I would do the following: - detect edit action by checking request.args(-3)=='edit' - retrieve modified_on of db

[web2py] Inconsistent file upload behaviour

2019-03-26 Thread 'Francis Windram' via web2py-users
Hi All, I'm having a very very weird problem with some upload processing I'm performing in web2py. Firstly for context here is the code I am using: Controller: def validate_test(): form = SQLFORM.factory( Field('csvfile', 'upload'), table_name="dataset_upload") if form.validate()

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread Anthony
On Monday, March 25, 2019 at 7:58:56 PM UTC-4, João Matos wrote: > > I need the records from the grid itself. > The objective is to be able to compare the modified_on field from the > record of the grid with the same record on the db at the moment of the save > (onvalidation) to detect if there w

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread João Matos
I just save the grid rows to session using this if grid.rows: session.grid_rows = grid.rows.as_dict() And then in onvalidation function I compare the grid's row modified_on (selecting the correct row that was in the edit form), with the db record modified_on using this if reque

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread João Matos
@Anthony Just realized by your solution that form has a record struct that I can use. So the solution became much simpler. No need to copy the grid.rows to session. And onvalidation function became if request.args and request.args[0] == 'new': ... elif form.record.modified_on !=

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread João Matos
Spoke too soon. Doesn't work. had to revert to my previous solution (save grid.rows to session ). terça-feira, 26 de Março de 2019 às 14:38:31 UTC, João Matos escreveu: > > @Anthony > Just realized by your solution that form has a record struct that I can > use. > So the solution became muc

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread Anthony
On Tuesday, March 26, 2019 at 11:03:19 AM UTC-4, João Matos wrote: > > Spoke too soon. Doesn't work. > had to revert to my previous solution (save grid.rows to session ). > Saving the entire grid.rows object to the session is unnecessary, as you only need the "modified_on" value of the partic

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread João Matos
Following your advice I changed my index function (where the grid is created) to if 'edit' in request.args: form = grid.update_form session.modified_on = form.record.modified_on And the onvalidation function to if request.args and request.args[0] == 'new': ...

[web2py] Re: Redis and Python3?

2019-03-26 Thread Jim S
Joe I'm not sure if this is relevant as I don't remember the exact error I was getting, but I made the following change just last week when I updated to the latest web2py stable. I went from: rconn = RConn(ccfg.redis.server, ccfg.redis.port) to: rconn = RConn('redis_connection_name', ccfg.re

[web2py] Argument problem with left join

2019-03-26 Thread Fabiano Faver
I'm trying to move an app from a old version of web2py (2.14) to latest version. After updating some code i'm stuck on the error below. If i remove the left join the query works. And I dont find anything about changes on 'left' syntax. Someone knows whats wrong? left_join() takes exactly 2 a

[web2py] Re: Error Ticket Includes Sensitive Information

2019-03-26 Thread zm
I feel like I am missing something, so forgive me if I sound sarcastic, it's not intended. The framework should present the ability to add an instance level filter of arguments, variables, and function calls that should be redacted from the ticket. In my use case, I am concerned with the pas

[web2py] Re: web2py returns an ImportError that can't find the module, but the .pyc file is in the _pycache__ dir

2019-03-26 Thread João Matos
I deleted both as instructed. After that I compiled and installed the compiled app on the destination server. The compiled app does not install the modules\general.py or the modules\general.pyc. terça-feira, 26 de Março de 2019 às 03:52:12 UTC, Massimo Di Pierro escreveu: > > all of them. > >

[web2py] Re: Error Ticket Includes Sensitive Information

2019-03-26 Thread Dave S
On Tuesday, March 26, 2019 at 2:29:18 PM UTC-7, zm wrote: > > I feel like I am missing something, so forgive me if I sound sarcastic, > it's not intended. > And I hope you didn't think I was rejecting your idea; I felt it worthy of discussion, but I wanted you to be more specific about the con

[web2py] Is there a way to differentiate between a form refresh (F5) and a submit that calls back the form?

2019-03-26 Thread João Matos
Is there a way to differentiate between a form refresh (F5) and a submit that calls back the form? -- 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 re

[web2py] Re: web2py returns an ImportError that can't find the module, but the .pyc file is in the _pycache__ dir

2019-03-26 Thread João Matos
If I recreate the modules\__pycache__ dir on my side, recompile and reinstall the app on the destination server, the compiled app copies the __pycache__ to the destination server when installing (which is correct), but does not copy the __pycache__\general.cpython-37.pyc to modules dir (which i

[web2py] Re: Is there a way to differentiate between a form refresh (F5) and a submit that calls back the form?

2019-03-26 Thread Anthony
What are you really trying to do? On Tuesday, March 26, 2019 at 5:55:50 PM UTC-4, João Matos wrote: > > Is there a way to differentiate between a form refresh (F5) and a submit > that calls back the form? > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://gi

[web2py] Re: Error Ticket Includes Sensitive Information

2019-03-26 Thread Anthony
I don't think it's possible, but feel free to get a discussion going on the developers' list . I'm sure a pull request would be welcome once an approach is decided. Anthony On Monday, March 25, 2019 at 1:57:00 PM UTC-4, zm w

[web2py] Re: How can I access the rows that resulted from the query made by SQLFORM.grid from onvalidation?

2019-03-26 Thread Anthony
> > What is the more secure way to transfer the modified_on? > Using > session.modified_on > or > form['hidden'].update(modified_on=form.record.modified_on) > and then > request.post_vars.modified_on > ? > I ask this because there is an option to make session secure when using > HTTPS. > If t