Re: [web2py] Re: Error accessing app edit

2019-03-17 Thread Massimo Di Pierro
can you provide a minimal controller default.py so we can reproduce and fix 
it?

On Sunday, 17 March 2019 20:55:59 UTC-7, Lovedie JC wrote:
>
> Python 3.
> I moved to python 3
> Regards 
>
> On Mon, 18 Mar 2019, 05:49 Massimo Di Pierro  
> wrote:
>
>> This says you are using python 3. Is your app build for python 3 or 
>> python 2? 
>>
>>
>> On Sunday, 17 March 2019 08:01:07 UTC-7, Maurice Waka wrote:
>>>
>>> When clicking on the edit button for my app, I get this error:
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>>
>>> Traceback (most recent call last):
>>>   File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in 
>>> restricted
>>> exec(ccode, environment)
>>>   File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
>>> , 
>>> line 2012, in 
>>>   File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
>>> self._caller = lambda f: f()
>>>   File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
>>> , 
>>> line 1130, in design
>>> items = find_exposed_functions(data)
>>>   File "/home/mauricewaka/web2py/gluon/compileapp.py", line 520, in 
>>> find_exposed_functions
>>> parsed = ast.parse(data)
>>>   File "/usr/lib/python3.6/ast.py", line 35, in parse
>>> return compile(source, filename, mode, PyCF_ONLY_AST)
>>>   File "", line 490
>>> _onclick="jQuery('#name').val('%s')" % k,
>>> ^
>>> SyntaxError: invalid syntax
>>>
>>>
>>> This is after upgrading to the new web2py 2.18.4
>>>
>>>
>>> Regards
>>>
>>> -- 
>> 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-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Error accessing app edit

2019-03-17 Thread Lovedie JC
Python 3.
I moved to python 3
Regards

On Mon, 18 Mar 2019, 05:49 Massimo Di Pierro 
wrote:

> This says you are using python 3. Is your app build for python 3 or python
> 2?
>
>
> On Sunday, 17 March 2019 08:01:07 UTC-7, Maurice Waka wrote:
>>
>> When clicking on the edit button for my app, I get this error:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>>
>> Traceback (most recent call last):
>>   File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in 
>> restricted
>> exec(ccode, environment)
>>   File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
>> , 
>> line 2012, in 
>>   File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
>> , 
>> line 1130, in design
>> items = find_exposed_functions(data)
>>   File "/home/mauricewaka/web2py/gluon/compileapp.py", line 520, in 
>> find_exposed_functions
>> parsed = ast.parse(data)
>>   File "/usr/lib/python3.6/ast.py", line 35, in parse
>> return compile(source, filename, mode, PyCF_ONLY_AST)
>>   File "", line 490
>> _onclick="jQuery('#name').val('%s')" % k,
>> ^
>> SyntaxError: invalid syntax
>>
>>
>> This is after upgrading to the new web2py 2.18.4
>>
>>
>> Regards
>>
>> --
> 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-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error accessing app edit

2019-03-17 Thread Massimo Di Pierro
This says you are using python 3. Is your app build for python 3 or python 
2? 


On Sunday, 17 March 2019 08:01:07 UTC-7, Maurice Waka wrote:
>
> When clicking on the edit button for my app, I get this error:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
>
> Traceback (most recent call last):
>   File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
> , line 
> 2012, in 
>   File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
> , line 
> 1130, in design
> items = find_exposed_functions(data)
>   File "/home/mauricewaka/web2py/gluon/compileapp.py", line 520, in 
> find_exposed_functions
> parsed = ast.parse(data)
>   File "/usr/lib/python3.6/ast.py", line 35, in parse
> return compile(source, filename, mode, PyCF_ONLY_AST)
>   File "", line 490
> _onclick="jQuery('#name').val('%s')" % k,
> ^
> SyntaxError: invalid syntax
>
>
> This is after upgrading to the new web2py 2.18.4
>
>
> Regards
>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py reboot

2019-03-17 Thread Massimo Di Pierro
I think web3py should be something a little different, not just web2py for 
python3.



On Sunday, 17 March 2019 05:42:16 UTC-7, Kevin Keller wrote:
>
> Hey,
>
> So I was wondering today what you guys would think about the idea to 
> rename web2py to Web3py, once it reaches a level of maturity that would be 
> able to justify the rename and a reboot.
>
> That would also mean to update the web page and various resources. 
>
> The reason is simple :
>
> It seems that since  around 2016 python 3 has seen a major increase in 
> adoption while web2py adoption decreased due to being perceived as python2 
> only framework, which at the time was certainly true.
>
> While it's not true anymore, I think the perception of being a python2 
> only framework combined with outdated resources doesn't help adoption.
>
> While sacrificing the established name is certainly not great, I think the 
> benefits of a reboot with a name change to emphasize the python3 
> compatibility would far outweigh any drawback.
> Python2 compatibility that is maintained would however seen as a plus and 
> a major differentiator to other frameworks that dropped python2 support. 
>
> What do you think? 
>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Poweredby error

2019-03-17 Thread Massimo Di Pierro
:-)



On Saturday, 16 March 2019 13:02:03 UTC-7, Daniel Guilhermino wrote:
>
> Hi Massimo,
>
> I just checked and it's working perfectly now!
>
> Many thanks, long life and prosper to you and Web2py!
>
> Best regards.
>
> Daniel Guilhermino
>
> Em sexta-feira, 15 de março de 2019 00:50:38 UTC-3, Massimo Di Pierro 
> escreveu:
>>
>> I will look into this asap.
>>
>> On Monday, 11 March 2019 05:15:57 UTC-7, Daniel Guilhermino wrote:
>>>
>>> Hi Kevin Keller,
>>>
>>> *I apologize, I believe I didn't express myself correctly.*
>>>
>>> *I tried to submit the application on the official web2py website, to be 
>>> part of the list "applications made with web2py", but an error ticket was 
>>> returned.*
>>>
>>> Thanks!
>>>
>>> Em sexta-feira, 8 de março de 2019 14:01:27 UTC-3, Kevin Keller escreveu:

 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 part of your app?

 Also which web2py version, os, python version etc do you use? 

 Thanks!

 On Fri, Mar 8, 2019 at 5:52 PM Daniel Guilhermino <
 danielgu...@gmail.com> wrote:

>  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: 
>> poweredby/191.162.178.30.2019-02-28.12-36-03.22ce450a-64b7-4832-8d08-750e16ce25c2
>>  
>> 
>>
>> Best regards,
>>
> -- 
> 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-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web2py install script python 3/Apache/Ubuntu

2019-03-17 Thread Massimo Di Pierro
In 2019 I really do not feel recommending using Apache to anybody. nginx 
has clearly won this battle.

On Sunday, 17 March 2019 19:35:55 UTC-7, gertk wrote:
>
> apt-get install libapache2-mod-wsgi-py3
>
> laupäev, 16. märts 2019 15:34.22 UTC+2 kirjutas Mamisoa Andriantafika:
>>
>> This script works with python 3 but is under nginx:
>>
>>
>> https://raw.githubusercontent.com/arisobel/web2py_scripts/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh
>>
>>
>>
>> Le samedi 16 mars 2019 13:12:06 UTC+1, Mamisoa Andriantafika a écrit :
>>>
>>> Sorry this does not work for me.
>>>
>>> Did you manage to get a server working with python 3 and apache?
>>>
>>> Le samedi 16 mars 2019 12:37:02 UTC+1, 黄祥 a écrit :

 think on line 164 and 165 is the culprit, should be
 sudo -u www-data *python3* -c "from gluon.widget import console; 
 console();"
 sudo -u www-data *python3* -c "from gluon.main import save_password; 
 save_password(raw_input('admin password: '),443)"

 best regards,
 stifan

>>>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Web2py binaries

2019-03-17 Thread Massimo Di Pierro
Fantastic. Will process this within the week and make it the new default.

On Friday, 15 March 2019 07:55:16 UTC-7, Nico Zanferrari wrote:
>
> Hi all,
>
> I've was successful in making the experimental Mac app, too, with python3. 
> Grab it from https://github.com/nicozanf/web2py-pyinstaller  , where 
> there are also all the instructions in order to build it by yourself ;-)
>
> A private feedback is appreciated.
>
> Nico
>
> Il giorno ven 15 mar 2019 alle ore 04:56 Massimo Di Pierro <
> massimo.dipie...@gmail.com> ha scritto:
>
>> The official version is currently broken.
>>
>> On Wednesday, 13 March 2019 15:53:09 UTC-7, Nico Zanferrari wrote:
>>>
>>> Hi,
>>>
>>> I've just updated the experimental Windows binary version with python 
>>> 3.7.2 to web2py 2.18.4 . Also, now there is in addition the no_console 
>>> binary and there is the python-ldap module included. Grab it from 
>>> https://github.com/nicozanf/web2py-pyinstaller : please test it and 
>>> give me a feedback.
>>>
>>> I'm still playing with the Mac version. Could someone confirm that the 
>>> current official binary version is really working? After typing the 
>>> password I've got the error 'module object has no attribute pbkdf2 hmac' - 
>>> maybe for the python version included. According to this  
>>> 
>>>  it 
>>> should have at least 2.7.8 but it seems with 2.7.3.
>>>
>>> Cheers,
>>> Nico
>>>
>> -- 
>> 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-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-03-17 Thread Massimo Di Pierro
I do not understand. this:

row: pydal.objects.Row = table[rec_id]


is not a valid Python code. Also, as you say pydal is not imported. 
Moreover Row is an internal class, you should not try redefine it.
Can you explain what you are trying to achieve? Maybe there is a better way.

On Friday, 8 March 2019 09:12:21 UTC-8, João Matos wrote:
>
> 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 pydal is imported by web2py.
>
>
>
>
> sexta-feira, 8 de Março de 2019 às 17:06:38 UTC, Leonel Câmara escreveu:
>>
>> 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 (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py 2.18.4 is OUT

2019-03-17 Thread Massimo Di Pierro
can you provide steps to reproduce?

On Thursday, 14 March 2019 23:49:22 UTC-7, Константин Комков wrote:
>
> I think I saved error in my app and after that I have error in web2py.
>  invalid syntax (, line 14)Версия
> web2py™ Version 2.18.4-stable+timestamp.2019.03.13.05.27.54
> Python Python 2.7.10: C:\Python27\python.exe (prefix: C:\Python27)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
>
> Traceback (most recent call last):
>   File ".\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:\inetpub\wwwroot\applications\admin\controllers/default.py", line 
> 2012, in 
>   File ".\gluon\globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "C:\inetpub\wwwroot\applications\admin\controllers/default.py", line 
> 1130, in design
> items = find_exposed_functions(data)
>   File ".\gluon\compileapp.py", line 520, in find_exposed_functions
> parsed = ast.parse(data)
>   File "C:\Python27\lib\ast.py", line 37, in parse
> return compile(source, filename, mode, PyCF_ONLY_AST)
>   File "", line 14
> import time, datetime, random, string, json
>  ^
> SyntaxError: invalid syntax
>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web2py install script python 3/Apache/Ubuntu

2019-03-17 Thread gertk
apt-get install libapache2-mod-wsgi-py3

laupäev, 16. märts 2019 15:34.22 UTC+2 kirjutas Mamisoa Andriantafika:
>
> This script works with python 3 but is under nginx:
>
>
> https://raw.githubusercontent.com/arisobel/web2py_scripts/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh
>
>
>
> Le samedi 16 mars 2019 13:12:06 UTC+1, Mamisoa Andriantafika a écrit :
>>
>> Sorry this does not work for me.
>>
>> Did you manage to get a server working with python 3 and apache?
>>
>> Le samedi 16 mars 2019 12:37:02 UTC+1, 黄祥 a écrit :
>>>
>>> think on line 164 and 165 is the culprit, should be
>>> sudo -u www-data *python3* -c "from gluon.widget import console; 
>>> console();"
>>> sudo -u www-data *python3* -c "from gluon.main import save_password; 
>>> save_password(raw_input('admin password: '),443)"
>>>
>>> best regards,
>>> stifan
>>>
>>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to show log event while form is submitted

2019-03-17 Thread isi_jca
Hi,

I have a form, when I click on submit button it is start processing and 
saving data (events) in table tlogproceso:

Controller

def fprocess ():

form = SQLFORM.factory (Field ('filename', 'upload', uploadfolder = 
os.path.join (request.folder, 'uploads'), label = 'DB file'))
if form.process (). accepted:
   db.tlogprocess.insert (date = datetime.datetime.now (), 
description = 'Start loading the dbf file.')
   ...
...
   db.tlogprocess.insert (date = datetime.datetime.now (), 
description = 'reading dbf file.')
...
...
   db.tlogproceso.insert (date = datetime.datetime.now (), 
description = 'Inserting data.')
...
...
   db.tlogproceso.insert (date = datetime.datetime.now (), 
description = 'Updating data.')
...
...
   db.tlogproceso.insert (date = datetime.datetime.now (), 
description = 'End of the process.')

 return locals ()

def showlogevent ():
 rows = db (db.tlogprocess.pid == 12) .select ()
 return locals ()

-- -

View (fprocesa.hmtl)

{{extend 'layout.html'}}
 My process 
{{= form}}

 Vitacora 
{{= LOAD ('default', 'showlogevent.load', ajax = True)}}


View (showlogevent.load)

{{for row in rows:}}

  date and time: {{= row.fecha}} {{= row.descripcion}}

{{pass}}


This way only when the process is finished, it shows the data. Is possible 
show data from tlogproceso while form is processing ?.

Thanks in advance.

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Error when deleting items

2019-03-17 Thread Maurice Waka
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=
False, field_id=None, selectable=lambda ids:delete_them(ids))
return locals()


def delete_them(ids):

if not ids:
session.flash='Please select the check-box to delete'
else:
for row in ids:
db(db.answers.id==row).delete()
pass
pass
return ''

But I get this error:

grid = SQLFORM.grid(db.answered.author == auth.user.id, editable=False, 
searchable=False, details= False, fields=None, csv=None, links=None, 
create=False, field_id=None, selectable=lambda ids:delete_them(ids))
TypeError: __call__() takes 1 positional argument but 2 were given

What do I do to correct this?

Regards

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Is it possible to log all errors to a log file using Python's logging?

2019-03-17 Thread Anthony
You can set up a custom error handler and do the logging 
there: http://web2py.com/books/default/chapter/29/04/the-core#Routes-on-error.

Anthony

On Sunday, March 17, 2019 at 12:59:18 PM UTC-4, João Matos wrote:
>
> Hello,
>
> Is it possible to log all errors (the same ones that go to the app\errors 
> dir) to a log file using Python's logging?
>
>
> 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 Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: I would like to log of all SQL commands web2py sends to SQLite. Is it possible?

2019-03-17 Thread Anthony
See http://web2py.com/books/default/chapter/29/04/the-core#Logging. For the 
logging.conf file format, 
see 
https://docs.python.org/2/library/logging.config.html#logging-config-fileformat.
 
You'll need to set up a handler for the "pyDAL" logger, which is what the 
DAL uses for logging.

On Sunday, March 17, 2019 at 4:39:26 AM UTC-4, João Matos wrote:
>
> Thanks Anthony, I activated debug=True in DAL but I can't find any log 
> file.
> Do you have any idea where it is created?
>
>
> domingo, 17 de Março de 2019 às 00:26:54 UTC, Anthony escreveu:
>>
>> Also, if you set DAL(..., debug=True), I believe all SQL commands will be 
>> logged to the "pyDAL" logger.
>>
>> Anthony
>>
>> On Saturday, March 16, 2019 at 5:57:47 PM UTC-4, Anthony wrote:
>>>
>>> Commands issued during migration operations are already saved to 
>>> /databases/sql.log. If you want all commands (i.e., queries), note that on 
>>> each request, there is db._timings, which is a list of tuples, where the 
>>> first element of each tuple is the SQL command issued and the second 
>>> element is the amount of time it took to execute. At the end of every 
>>> request, you could dump the contents of db._timings to a log. You can do 
>>> that by assigning a callback function to response._caller(), which wraps 
>>> all calls to controller actions. Note, it will therefore miss any queries 
>>> that are run in views, but it's probably not a good idea to run queries in 
>>> views anyway. You could also set up middleware to do the logging: 
>>> http://web2py.com/books/default/chapter/29/04/the-core?search=_caller#WSGI
>>> .
>>>
>>> Anthony
>>>
>>> On Saturday, March 16, 2019 at 4:54:52 PM UTC-4, João Matos wrote:

 Hello,

 I would like to log of all SQL commands web2py sends to SQLlite. Is it 
 possible?

 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 Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] I get a strange syntax error if I divide a = web2py "command" in 2 lines inside a HTML file

2019-03-17 Thread João Matos
Hello,

If I use this code, everything works

  =A(T('You have unread notifications'), _href=URL('default', 
'index', user_signature=True)) if count else ''

However, if I divide it in 2 lines, using proper ( ), I get a syntax error

  =(A(T('You have unread notifications'), 
_href=URL('default', 'index', user_signature=True)) if 
count else '')

Is this the correct behavior of web2py = "command" parsing?

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 Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Is it possible to make a form field depend on another form field without submiting the form?

2019-03-17 Thread João Matos
I'll check it out in the next days, thanks.

sexta-feira, 15 de Março de 2019 às 11:34:09 UTC, Leonel Câmara escreveu:
>
> Here's an example I made long ago, I would do things differently nowadays 
> but it shows how it can be done.
>
> https://groups.google.com/forum/#!topic/web2py/z_lGYsO6LKE 
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Is it possible to log all errors to a log file using Python's logging?

2019-03-17 Thread João Matos
Hello,

Is it possible to log all errors (the same ones that go to the app\errors 
dir) to a log file using Python's logging?


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 Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Filtering through a selected group of entities with a search function

2019-03-17 Thread mostwanted
I have a table of companies that offer variable services, what i want is to 
enable my users to search for companies that offer a desired service *(which 
i have been able to achieve)* and then from that very list of companies 
displayed in that page be able to filter through them and search for 
companies in a desired location offering that very same service *(this is 
where i am facing a problem)* how do i achieve this because?? In terms of 
searching I can only search for companies in a desired location but can not 
combine my search to only display those of the searched service!

*MODEL*:
db.define_table('locations',
Field('name'),
format='%(name)s')
def name_of(location): return '%(name)s' % location

db.define_table('business',
Field('logo', 'upload'),
Field('company_name', requires=IS_NOT_EMPTY()),
Field('services', 'reference services'),
#Field('tlamelo', 'reference tlamelo'),
Field('product', 'reference product'),
Field('tel', requires=IS_NOT_EMPTY()),
Field('email', requires=IS_NOT_EMPTY()),
Field('fax', requires=IS_NOT_EMPTY()),
Field('cell', requires=IS_NOT_EMPTY()),
Field('facebook', requires=IS_NOT_EMPTY()),
Field('twitter', requires=IS_NOT_EMPTY()),
Field('website', requires=IS_NOT_EMPTY()),
Field('postal_address', requires=IS_NOT_EMPTY()),
Field('place', 'reference locations'),
Field('located_at', requires=IS_NOT_EMPTY()))

*CONTROLLER*:
def companies():
results=db.services(request.args(0))
rslts=db(db.business.services==results.id).select(db.business.ALL, 
orderby=db.business.company_name)
services=len(rslts)
form=SQLFORM.factory(Field('query', requires=IS_NOT_EMPTY(), label=SPAN(
'', _style="font-weight: bold;"), widget = lambda field, value: SQLFORM.
widgets.string.widget(field, value, _class='my-string', _id='searching', 
_placeholder='LOCATION')))
searchBtn=form.element('input',_type='submit')
searchBtn['_style'] = 'display:none;'
if form.accepts(request):
tokens=form.vars.query.split()
query=reduce(lambda a,b:a, [db.locations.name.contains(k) for k in 
tokens])
location=db(query).select(orderby=db.locations.name)
else:
location=[]
return locals()

def Results():
results=db.locations(request.args(0))
results2=db.services(request.args(0))
#THIS IS WHERE I AM ATTEMPTING TO SELECT SERVICE PROVIDERS OF THE DESIRED 
SERVICE IN A DESIRED LOCATION BUT THE ALGORITHM IS WRONG WHERE IT IS MARKED 
IN RED, HOW CAN I SELECT BOTH THE SERVICE AND LOCATION TO BE DISPLAYED IN 
THE OTHER PAGE???
rslts=db(db.business.place==results.id).select(db.business.services==
results2.id)
services=len(rslts)
return locals()

*VIEW*
{{extend 'layout.html'}}

{{for company in rslts:}}
{{=company.company_name}}
{{pass}}

I hope my question is clear.

Please help me, anyone???* (sad emojis)*

Mostwanted

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Error accessing app edit

2019-03-17 Thread Maurice Waka
When clicking on the edit button for my app, I get this error:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.

Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
, line 
2012, in 
  File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/home/mauricewaka/web2py/applications/admin/controllers/default.py" 
, line 
1130, in design
items = find_exposed_functions(data)
  File "/home/mauricewaka/web2py/gluon/compileapp.py", line 520, in 
find_exposed_functions
parsed = ast.parse(data)
  File "/usr/lib/python3.6/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
  File "", line 490
_onclick="jQuery('#name').val('%s')" % k,
^
SyntaxError: invalid syntax


This is after upgrading to the new web2py 2.18.4


Regards

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Web3py reboot

2019-03-17 Thread Kevin Keller
Hey,

So I was wondering today what you guys would think about the idea to rename 
web2py to Web3py, once it reaches a level of maturity that would be able to 
justify the rename and a reboot.

That would also mean to update the web page and various resources. 

The reason is simple :

It seems that since  around 2016 python 3 has seen a major increase in adoption 
while web2py adoption decreased due to being perceived as python2 only 
framework, which at the time was certainly true.

While it's not true anymore, I think the perception of being a python2 only 
framework combined with outdated resources doesn't help adoption.

While sacrificing the established name is certainly not great, I think the 
benefits of a reboot with a name change to emphasize the python3 compatibility 
would far outweigh any drawback.
Python2 compatibility that is maintained would however seen as a plus and a 
major differentiator to other frameworks that dropped python2 support. 



What do you think? 

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Git: save init application as separate repo from web2py, and exclude the init directory?

2019-03-17 Thread Tom Campbell
My (soon to be production) code is in the application named init.
Obviously init is surrounded by the web2py installation itself.
We will want to preserve the working version of web2py in a git repo since 
it's likely we will update web2py separately from the init app.
I assume the best practice is to save the init application in another repo, 
and exclude the init directory from the web2py repo?
Bonus question: I'm using Python 2.7. Should I upgrade to 3.0?

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: I would like to log of all SQL commands web2py sends to SQLite. Is it possible?

2019-03-17 Thread João Matos
Thanks Anthony, I activated debug=True in DAL but I can't find any log file.
Do you have any idea where it is created?


domingo, 17 de Março de 2019 às 00:26:54 UTC, Anthony escreveu:
>
> Also, if you set DAL(..., debug=True), I believe all SQL commands will be 
> logged to the "pyDAL" logger.
>
> Anthony
>
> On Saturday, March 16, 2019 at 5:57:47 PM UTC-4, Anthony wrote:
>>
>> Commands issued during migration operations are already saved to 
>> /databases/sql.log. If you want all commands (i.e., queries), note that on 
>> each request, there is db._timings, which is a list of tuples, where the 
>> first element of each tuple is the SQL command issued and the second 
>> element is the amount of time it took to execute. At the end of every 
>> request, you could dump the contents of db._timings to a log. You can do 
>> that by assigning a callback function to response._caller(), which wraps 
>> all calls to controller actions. Note, it will therefore miss any queries 
>> that are run in views, but it's probably not a good idea to run queries in 
>> views anyway. You could also set up middleware to do the logging: 
>> http://web2py.com/books/default/chapter/29/04/the-core?search=_caller#WSGI
>> .
>>
>> Anthony
>>
>> On Saturday, March 16, 2019 at 4:54:52 PM UTC-4, João Matos wrote:
>>>
>>> Hello,
>>>
>>> I would like to log of all SQL commands web2py sends to SQLlite. Is it 
>>> possible?
>>>
>>> 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 Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.