Re: [web2py] Re: How to catch index error

2019-03-19 Thread Maurice Waka
This works well Boss!! Thanks a lot and God Bless! Regards On Wed, Mar 20, 2019 at 3:45 AM Leonel Câmara wrote: > Notice that, it seems you are using [-1] because want to get the last > record where the user was awake/light sleep/sleep, however you don't use an > order by, so depending on the st

[web2py] Redis and Python3?

2019-03-19 Thread Joe Barnhart
Has something changed in the operation of redis to store sessions in web2py when we use python3 instead of python2? I'm hitting an error in the py-redis library that complains I can't store a boolean in redis (unsupported data type). Since this seems to be a well known design feature of redis

[web2py] Re: How to catch index error

2019-03-19 Thread Leonel Câmara
Notice that, it seems you are using [-1] because want to get the last record where the user was awake/light sleep/sleep, however you don't use an order by, so depending on the strategy the database decides to use, there's no guarantee that it will be the last. This is also inefficient because yo

[web2py] Re: New International Telegram Support Group

2019-03-19 Thread Paco Bernal
I just joined the group. Great to be here Thx 2 all and join the group please -- 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

[web2py] Re: How to catch index error

2019-03-19 Thread Dave S
On Tuesday, March 19, 2019 at 11:57:35 AM UTC-7, Maurice Waka wrote: > > I have a code that works OK except when there is no data in the database. > > [...] > gauge.add('Awake', [{'value':[i.awake for i in data][-1], 'max_value': > 24}]) > gauge.add('Light Sleep', [{'value':[i.light_sl

[web2py] Re: How to catch index error

2019-03-19 Thread isi_jca
In this place def sleep_chart(): response.files.append(URL('e_default','static/js/pygal-tooltips.min.js')) response.headers['Content-Type']='image/svg+xml' custom_style = Style( background='transparent', plot_background='transparent', foreground='#53E89B',

Re: [web2py] Re: Error accessing app edit

2019-03-19 Thread Maurice Waka
Thanks I'll follow up On Mon, 18 Mar 2019, 18:08 Leonel Câmara wrote: > This was due to changes I made to the way web2py discovers exposed > functions in a controller file. It uses the python parser so it has a > problem with syntax errors. I made a pull request that teaches the admin to > deal

[web2py] How to catch index error

2019-03-19 Thread Maurice Waka
I have a code that works OK except when there is no data in the database. Here is the code, using MongoDB. model code: db.define_table('sleep', Field('awake','double',default=0), Field('light_sleep','double',default=0), Field('deep_sleep','double',de

[web2py] Re: New International Telegram Support Group

2019-03-19 Thread Ari Lion BR Sp
Oh, Great Now I see a new link to this group: https://t.me/web2py_world Great I joined. That's great that Leonel Camara also joined the group! Now we can be sure that no doubt we have will be unanswered :-) Thanks! Em terça-feira, 19 de março de 2019 12:26:09 UTC-3, Carlos Costa escreveu: >

[web2py] Re: New International Telegram Support Group

2019-03-19 Thread Carlos Costa
we noticied this group has no administrator, so we are moving to a new one, here is the link https://t.me/joinchat/DYZrfBT-bIsVhwLZc1hG8Q Em terça-feira, 19 de março de 2019 12:14:17 UTC-3, Carlos Costa escreveu: > > We have had a good experience with the brazilian telegram group dedicated > t

[web2py] New International Telegram Support Group

2019-03-19 Thread Carlos Costa
We have had a good experience with the brazilian telegram group dedicated to to support web2py users. But the english speaking group is not used at. Here is the link to join it: https://t.me/web2py_en Also, here is the link to the Brazilian group (portuguese speaking and some portunhol allowed

[web2py] Re: ST_Transform in GIS support

2019-03-19 Thread David Orme
So, in addition to st_transform, I would add st_aswkb. This isn't an official Postgis command - it provides a method to bypass the automatic conversion to WKT found in here: https://github.com/web2py/pydal/blob/master/pydal/adapters/base.py#L550 With a suitably modified PostgreRepresenter, that

[web2py] Re: How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread João Matos
That's it. Thanks. terça-feira, 19 de Março de 2019 às 12:41:50 UTC, Leonel Câmara escreveu: > > Something like this: > > from gluon.languages import write_dict > > def make_portuguese_entry(fields, recordid): > T.force('pt') > T.t[fields[name_of_the_field]] = fields[name_of_the_field_pt]

[web2py] Re: How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread Leonel Câmara
Something like this: from gluon.languages import write_dict def make_portuguese_entry(fields, recordid): T.force('pt') T.t[fields[name_of_the_field]] = fields[name_of_the_field_pt] if T.is_writable: write_dict(T.language_file, T.t) your_table._after_insert.append(make_portugu

[web2py] Re: ST_Transform in GIS support

2019-03-19 Thread David Orme
I guess more generally there is an issue with having to do a round trip through WKT to update a record - it loses precision and is there is an explicit warning about using it for passing data: http://postgis.org/docs/ST_AsText.html I don't see any point in altering how the select represents the

[web2py] Re: How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread João Matos
Yes, the user will enter both languages (EN and PT). I would like to add the pair to languages\pt.py. terça-feira, 19 de Março de 2019 às 11:27:06 UTC, Leonel Câmara escreveu: > > How would web2py know how to translate it when the record is inserted to > fill that part? Is it one of the fields?

[web2py] Re: ST_Transform in GIS support

2019-03-19 Thread Leonel Câmara
That looks great to me! -- 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

[web2py] ST_Transform in GIS support

2019-03-19 Thread David Orme
Hi, I wanted to see if anyone has opinions on adding ST_Transform in to the list of available GIS commands. I've only looked at this from the point of view of PostgreSQL and PostGIS, but there is precedent for having Postgre only GIS functions. The basic argument is that coordinate transformati

[web2py] Re: How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread Leonel Câmara
How would web2py know how to translate it when the record is inserted to fill that part? Is it one of the fields? -- 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 Is

[web2py] Re: How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread João Matos
Thanks. Doesn't that only add the left entry part? How can I know the current selected language, so that I can return to it after adding the entry? terça-feira, 19 de Março de 2019 às 09:56:33 UTC, Leonel Câmara escreveu: > > Ideally you don't. Frankly web2py's translation system is not ideal

[web2py] Re: How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread Leonel Câmara
Ideally you don't. Frankly web2py's translation system is not ideal for dynamic content. That said, you can simply put a function in the record's table _after_insert that is something like this: def make_portuguese_entry(fields, recordid): T.force('pt') T(fields[name_of_the_field], lazy=

[web2py] How can I add entries to languages\pt.py file when a user adds a record?

2019-03-19 Thread João Matos
Hello, I would like to add entries to languages\pt.py file when a user adds a record. How can I do that? Thanks, JM -- 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

Re: [web2py] Error when deleting items

2019-03-19 Thread Lovedie JC
Any help on this? On Mon, 18 Mar 2019, 00:31 Maurice Waka wrote: > This is my simple code when using to delete items from my database. > > grid = SQLFORM.grid(db.answered.author == auth.user.id, editable=False > , searchable=False, details= False, fields=None, csv=None, links=None, > create=