Re: [web2py] Re: Creating table on the fly with the app in production

2019-03-08 Thread Gualter Portella
Thanks, Leonel! I will try it out tomorrow. Cheers Enviado do meu iPhone Em 8 de mar de 2019, à(s) 19:58, Leonel Câmara escreveu: > The simple stuff you talk about should simply work: > > 0. backup the database, this is just good practice... > 1. if you're running the scheduler you should

[web2py] Re: Open a new page in the browser from redirect or URL

2019-03-08 Thread icodk
My be it is an idea for improving the grid by add (yet another) option to have radio buttons instead of checkboxes On Saturday, March 9, 2019 at 12:08:50 AM UTC+1, icodk wrote: > > I would do it in javascript in the view and simulate radio buttons, which > means that every time the user is

[web2py] Re: Open a new page in the browser from redirect or URL

2019-03-08 Thread João Matos
The grid's checkboxes (and their multiple selection) are not the problem. The problem is that my origin page has a grid with extra buttons, using the selectable option. And I wanted one of the buttons (from the selectable option) to open a view in another browser page. Can I control the buttons

[web2py] Re: Open a new page in the browser from redirect or URL

2019-03-08 Thread icodk
I would do it in javascript in the view and simulate radio buttons, which means that every time the user is selecting a checkbox the script will clear the former selected checkbox. This way you don't have to deal with informing the user, about multiple selections. On Friday, March 8, 2019 at

[web2py] Re: Creating table on the fly with the app in production

2019-03-08 Thread Leonel Câmara
The simple stuff you talk about should simply work: 0. backup the database, this is just good practice... 1. if you're running the scheduler you should stop it until migration is finished and migrate is disabled 2. update the code making sure migrate is True. 3. visit appadmin to make sure all

[web2py] Creating table on the fly with the app in production

2019-03-08 Thread Gualter Portella
Hi everyone, My app is in production and is hosted at RoseHosting. I will soon need to create several tables and want to avoid those “auth.user table has already been created” messages when the app crashes as I insert new code on, for example, db.py. I will insert code like this, simple stuff:

[web2py] Re: Open a new page in the browser from redirect or URL

2019-03-08 Thread João Matos
The problem is that my origin page has a grid with extra buttons, using the selectable option. And that option does not allow using _target or anything similar. It can only call a function (which is the function on the 1st message). That function checks if there is only 1 record selected in the

[web2py] Re: Open a new page in the browser from redirect or URL

2019-03-08 Thread Leonel Câmara
It's sort of possible using response.js = "window.open(url, '_blank')" however any modern browser will consider this a popup and block it because it's a window.open that's not coming as a direct result of a click, you can then move a step forward fighting with the user's browser preferences and

[web2py] Open a new page in the browser from redirect or URL

2019-03-08 Thread João Matos
Hello, I have this function def check_only_one_selection(ids, destination): # type: (List[int], str) -> None """Check only one selection in grid. :param ids: List of Ids. :param destination: Destination page if one selection was made. """ if len(ids) > 1:

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread João Matos
I'm using Python 3.7.1. Can that explain this strange situation? I'm calling web2py with the -e command line option to see the errors and there are none. sexta-feira, 8 de Março de 2019 às 18:30:48 UTC, Leonel Câmara escreveu: > > web2py doesn't do that. This is weird. Both those lines should

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread Leonel Câmara
web2py doesn't do that. This is weird. Both those lines should give you errors. -- 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

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread João Matos
Just for testing, I removed pydal.objects.Table from the function header and changed the line inside the function from row: pydal.objects.Row = table[rec_id] to row: pydal.objects.Table = table[rec_id] without importing anything from pydal or pydal.objects, anywhere in controllers, models or

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread João Matos
No, I don't import pydal.objects.Row anywhere in my modules, controllers even in models. sexta-feira, 8 de Março de 2019 às 17:40:41 UTC, Leonel Câmara escreveu: > > Weird because that doesn't work for me if I don't import pydal so I'm > guessing you have a import pydal.objects.Row somewhere

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

2019-03-08 Thread Leonel Câmara
Note that parent_name should be the actual field name and not the field itself. In your case parent_name='object_super_object_fk' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread Leonel Câmara
Weird because that doesn't work for me if I don't import pydal so I'm guessing you have a import pydal.objects.Row somewhere in your models. That said you can just use DAL.Table and DAL.Row which are imports web2py does make for you. -- Resources: - http://web2py.com - http://web2py.com/book

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

2019-03-08 Thread Alex Glaros
The manual’s example uses a single, self-referencing table. What would be the syntax for joined, parent/child tables? I get an AttributeError. Not sure if the parent_name formation is the problem roots = db((db.role_member.id > 0) & (db.role_member.object_super_object_fk ==

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread João Matos
Didn't know that, will correct auth.requires_login with auth.is_logged_in. No I did not import pydal. If I remove the type specification from the function header it works, even when I'm also mentioning pydal inside the function in the line row: pydal.objects.Row = table[rec_id] which means

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread Leonel Câmara
Note that requires_login is meant to be used as a decorator, you should be using auth.is_logged_in() Did you import pydal? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list

Re: [web2py] Re: Poweredby error

2019-03-08 Thread Kevin Keller
Hey Daniel, we need a bit more details to be able to see what is going on. We can not see what the ticket text says from the link that you posted. Please share the full traceback. Give us a glimbs what you want to achieve and what you have already done. Which models/functions are doing the main

[web2py] Re: Poweredby error

2019-03-08 Thread Daniel Guilhermino
Anyone? Em quinta-feira, 28 de fevereiro de 2019 09:42:56 UTC-3, Daniel Guilhermino escreveu: > > Hi, > > I've just tried to submit an new application made with web2py and > integrated with Dialogflow, but the following error was show: > > > Internal errorTicket issued: >

Re: [web2py] Re: web2py reports "invalid function (client/get_approval)" when function has typing return type

2019-03-08 Thread João Matos
Hello, I already opened an issue on Github. Thanks, but I prefer to stick with the old type syntax # type: () -> Dict[str, SQLFORM] solution instead of creating another function. Best regards, João Matos On 08-03-2019 16:45,

[web2py] Re: web2py reports "invalid function (client/get_approval)" when function has typing return type

2019-03-08 Thread Anthony
In order to determine which functions in a controller file to expose as actions, web2py uses the following regex (the intention is to identify only functions that take no arguments and don't start with a double underscore): '^def\s+(?P_?[a-zA-Z0-9]\w*)\( *\)\s*:' As you can see, this does not

[web2py] web2py reports "invalid function (client/get_approval)" when function has typing return type

2019-03-08 Thread João Matos
If I write this function from typing import Dict @auth.requires(lambda: (auth.requires_login() and request.env.http_referer and ('/client' in request.env.http_referer or '/client/get_approval' in request.env.http_referer))) def

[web2py] "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-08 Thread João Matos
If I write this function @auth.requires(lambda: (auth.requires_login() and request.env.http_referer and '/client' in request.env.http_referer)) def on_delete(table: pydal.objects.Table, rec_id: str): """Grid delete button action. :param table: Table. :param

[web2py] Re: compiled files location

2019-03-08 Thread icodk
Thanks On Friday, March 8, 2019 at 2:49:58 PM UTC+1, Anthony wrote: > > On Friday, March 8, 2019 at 4:55:02 AM UTC-5, icodk wrote: >> >> So if I understand it right, web2py caches compiled application files >> and do it on the first demand or a source change and never write back to >>

[web2py] Re: compiled files location

2019-03-08 Thread Anthony
On Friday, March 8, 2019 at 4:55:02 AM UTC-5, icodk wrote: > > So if I understand it right, web2py caches compiled application files and > do it on the first demand or a source change and never write back to > storage/disk. If so, Is there any advantage for compiled web2py > application

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

2019-03-08 Thread Leonel Câmara
Use as_trees orgchart = db(db.your_table_which_records_have_parents).select().as_trees() See as_trees documentation def as_trees(self, parent_name='parent_id', children_name='children', render=False): """ returns the data as list of trees. :param

[web2py] Re: compiled files location

2019-03-08 Thread icodk
So if I understand it right, web2py caches compiled application files and do it on the first demand or a source change and never write back to storage/disk. If so, Is there any advantage for compiled web2py application (except the one time load and compile after web server reset)? On Friday,