Re: [web2py] Re: web2py with js framework

2017-08-17 Thread António Ramos
my 2 cents... https://youtu.be/zt5gnKk40Zw 2017-08-16 22:23 GMT+01:00 António Ramos : > The first video tut about this deserves a beer... > > > > Sem > vírus. www.avast.com >

[web2py] Sharing function between controller and scheduler

2017-08-17 Thread David Orme
Hi, I have a function that checks an uploaded file. I want the check to get scheduled automatically on upload but I also want admin user to be able to run the check live from the website (it doesn't take too long). I currently have a single function in a model that gets shared, but then it has

[web2py] unit testing newbiew ... and error...

2017-08-17 Thread António Ramos
Hello i´m trying to test my web2py app Never used any testing before, so be patient.. after reading this http://www.web2py.com/AlterEgo/default/show/260 and this http://www.web2py.com/AlterEgo/default/show/213 i tried the code but got this error [image: Imagem inline 1] i opened globals.

Re: [web2py] unit testing newbiew ... and error...

2017-08-17 Thread José Luis Redrejo
Antonio, I would not recommend you usint unittest classes, if you read any modern Python testing book or article, they all recommend using pytest. I used it in this project https://github.com/jredrejo/bancal/tree/master/web2py/applications/bancal just in case it can help you. Regards José L. 2017

[web2py] Re: troubles with scheduler

2017-08-17 Thread Mirek Zvolský
Thank you, Val K, I think this helped me lot. Good idea: to separate the problem - 1) system+scheduler, 2) served python task I have replaced the python task with a) cycle with sleep (CPU low), b) cycle with pass (CPU >> 100%) and in both cases there was no problem with scheduler. So I know th

[web2py] warning for postgres users: current contrib/pg8000 is old and causes weird postgres errors

2017-08-17 Thread Mirek Zvolský
As long the contrib/pg8000 version is old, it is good idea to install the current version: pip install pg8000 Errors from old driver are like (at least pg 9.6, long running tasks): OperationalError, Broken Pipe,... I have created issues: https://github.com/web2py/web2py/issues/1742 https://githu

Re: [web2py] Re: book help

2017-08-17 Thread Richard Vézina
No... Hmm... Use Github oneline, you should have button beside your branch like "Create a PR" or something like that... It weird that you github desktop porpose you to create a PR against you own repo... I guess your setup is not properly done... Is your local copy a clone of you own repo or a clon

Re: [web2py] unit testing newbiew ... and error...

2017-08-17 Thread António Ramos
Great Where can i find some discussion on this file ? i get an error at line 149 https://github.com/viniciusban/web2py.test/blob/master/tests/conftest.py#L149 Regards 2017-08-17 12:53 GMT+01:00 José Luis Redrejo : > Antonio, I would not recommend you usint unittest classes, if you read any > mod

[web2py] Re: Sharing function between controller and scheduler

2017-08-17 Thread Leonel Câmara
That seems fine to me. Note however that you can know if the function is being run by the scheduler looking at request.is_scheduler -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues

Re: [web2py] unit testing newbiew ... and error...

2017-08-17 Thread António Ramos
[image: Imagem inline 1] 2017-08-17 14:18 GMT+01:00 António Ramos : > Great > Where can i find some discussion on this file ? > i get an error at line 149 > https://github.com/viniciusban/web2py.test/blob/ > master/tests/conftest.py#L149 > > Regards > > 2017-08-17 12:53 GMT+01:00 José Luis Redrej

Re: [web2py] Sharing function between controller and scheduler

2017-08-17 Thread David Orme
Aha. That is very helpful. Thanks very much. Cheers, David > On 17 Aug 2017, at 14:20, Leonel Câmara wrote: > > That seems fine to me. Note however that you can know if the function is > being run by the scheduler looking at request.is_scheduler > > -- > Resources: > - http://web2py.com

[web2py] Re: web2py 2.15.3 is OUT

2017-08-17 Thread Mirek Zvolský
For me: 1) I had no file applications/admin/private/hosts.deny -> when manually created, admin works. 2) This doesn't work for me in templates (was Ok in version from 2016): {{=MARKMIN(T("**something bold** something more"))}} This works: {{=T("**something** something")}} Error for the 1st case

[web2py] Re: web2py 2.15.3 is OUT

2017-08-17 Thread Mirek Zvolský
Hotfix for MARKMIN(T()) is bellow. gluon/html.py +empty string in 1st line of MARKMIN constructor. But no idea what is broken with such stupid fix (py3,..) class MARKMIN(XmlComponent): """ For documentation: http://web2py.com/examples/static/markmin.html """ def __init__(se

[web2py] Re: Sharing function between controller and scheduler

2017-08-17 Thread Anthony
Also, note that it shouldn't be a problem to call db.commit() within a controller action. The only downside is if the action subsequently throws an exception and a ticket is issued, the transaction that was committed will not be rolled back. Anthony On Thursday, August 17, 2017 at 9:20:06 AM U

[web2py] Re: warning for postgres users: current contrib/pg8000 is old and causes weird postgres errors

2017-08-17 Thread Mirek Zvolský
Other advantage (for me) is that the database access with the current version of pg8000 seems to be faster (- 30% ?). Dne čtvrtek 17. srpna 2017 14:33:51 UTC+2 Mirek Zvolský napsal(a): > > As long the contrib/pg8000 version is old, > it is good idea to install the current version: pip install p

Re: [web2py] unit testing newbiew ... and error...

2017-08-17 Thread António Ramos
I deleted the line del web2py_env['__file__'] then next error [image: Imagem inline 1] disabling the code i then get to the tests execution My simple test is def test_index_exists(client): '''page index exists? ''' client.get('people/default/index') i get an error from gluon.

Re: [web2py] unit testing newbiew ... and error...

2017-08-17 Thread António Ramos
seems that removing "people" solves it. 2017-08-17 17:29 GMT+01:00 António Ramos : > I deleted the line > del web2py_env['__file__'] > > then next error > > [image: Imagem inline 1] > > disabling the code i then get to the tests execution > > My simple test is > > def test_index_exists(cli

[web2py] Re: Sharing function between controller and scheduler

2017-08-17 Thread David Orme
I've still got some very odd differences between the controller and the scheduler. The task function uses an external module, stored in the application `modules` folder. I've updated it recently, and deleted the .pyc before doing so, so it should all be up to date. I've also restarted the apach

[web2py] Re: troubles with scheduler

2017-08-17 Thread Dave S
On Thursday, August 17, 2017 at 4:59:10 AM UTC-7, Mirek Zvolský wrote: > > I think reason is the too old contrib/pg8000 driver. > It is something like listed here (pg8000+web2py): > https://github.com/mfenniak/pg8000/issues/73 > I have installed the current one pg8000 and it looks well, without

[web2py] Re: Sharing function between controller and scheduler

2017-08-17 Thread Anthony
Yes, the worker processes are separate instances of the Python interpreter, so you must restart them for any changes in modules to take effect. Anthony On Thursday, August 17, 2017 at 1:51:44 PM UTC-4, David Orme wrote: > > I've still got some very odd differences between the controller and the

[web2py] Como calcular dias entre datas yyyy-mm-aa num campo integer

2017-08-17 Thread everton rocha
db.define_table("servicos", Field('empresa', 'reference empresa', label='Empresa'), Field('cliente', 'reference cliente', label='cliente'), Field("contrat_ini","date",label='Inicio do Contrato'), Field("contrat_fim","date", label='Fim

[web2py] Re: how calculate field total

2017-08-17 Thread everton rocha
Alexandre, Desculpa pegar carona no seu post. Pode me ajudar? Tentei adaptar seu código, mas sem sucesso. Desculpe mais uma vez def ver_todos_projetos(): db.servicos.id.readable = False query = ((db.servicos.id > 0)) fields = (db.servicos.id, db.servicos.empresa, db.servicos.con

[web2py] Re: Como calcular dias entre datas yyyy-mm-aa num campo integer

2017-08-17 Thread Leonel Câmara
Everton a maneira mais fácil de fazeres isto é com um campo computado # Modelo db.define_table("servicos", Field('empresa', 'reference empresa', label='Empresa'), Field('cliente', 'reference cliente', label='cliente'), Field("contrat_ini","date",lab

[web2py] auth_cas redis session_filename + logout issue

2017-08-17 Thread Mark Graves
Hey everyone, Question / potential bug(s): I created the following to reproduce: https://bitbucket.org/MarkGraves/web2py_cas Basically, when I run that setup.sh, it sets up two apps and installs redis in virtual environments, copies in web2py, and replaces db.py with the one in the main rep

Re: [web2py] Re: Getting 404 NOT FOUND error when accessing a few pages of my app.

2017-08-17 Thread Rahul
Okay after setting up my project on another machine I am still getting this error. I am sure that there is something that might have got deleted or changed accidently in my project. I'll check the same and get back with the problem and solution. This might take some time though :( Thanks, Rah