[web2py] Re: web2py.scheduler.hpxyz#2791 - ERROR - we received a task that isn't there (15)

2018-02-27 Thread Pierre
I did the change at line 732 and the error continues to show up 
(immediate=True). Besides there is another problem i forgot to mention 
earlier :
the scheduler_task and scheduler_run tables are not updated properly. what 
i do is run a python script using the requests and threading module to 
perform app stress tests. every time i run this script, it's supposed to 
queue 100 new tasks and delegate work to the workers. first time i run the 
script new tasks are added to the tables as they should but not the 
second,thirdtimes. With the change you suggested script may return HTTP 
errors 500 which is something new


if you or someone else could tell me *how to start a python-rq worker 
within web2py* i'd like to give it a try, otherwise what would be the 
workaround if any?

https://groups.google.com/forum/#!msg/web2py/kAG2Y_tDoUE/ycJAdjj1hsgJ
https://groups.google.com/forum/#!msg/web2py/js0VAKK6Dlw/CJ46I-0wT0wJ

from Bruno Rocha's receipt:  this doesn't seem to work (sh file to start a 
rq worker):

cd /pathTo/web2py
sudo python web2py.py -S myapp -M -R w2p-rqworker.py


-- 
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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
git clone --recursive web2py repo http address

On Tue, Feb 27, 2018 at 1:29 AM, pbreit  wrote:

> Could someone please confirm for me if I can just do a "git pull" or do I
> need to do something else to make sure I also get latest DAL?
>
> --
> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
git clone --recursive https://github.com/web2py/web2py.git

On Tue, Feb 27, 2018 at 10:20 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> git clone --recursive web2py repo http address
>
> On Tue, Feb 27, 2018 at 1:29 AM, pbreit  wrote:
>
>> Could someone please confirm for me if I can just do a "git pull" or do I
>> need to do something else to make sure I also get latest DAL?
>>
>> --
>> 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] Error using Postgres

2018-02-27 Thread Morganti
HI Massimo, I could import psycopg2 in web2py shell manually.

I used the installation script inside web2py scripts folder. Bellow the 
entire error:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File "/home/www-data/py27env/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/controllers/carreira.py" 
, line 
812, in 
  File "/home/www-data/py27env/web2py/gluon/globals.py", line 419, in 
self._caller = lambda f: f()
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/controllers/carreira.py" 
, line 
19, in gera_plano_carreira
vgraduacao = gera_graduacao()
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/controllers/carreira.py" 
, line 
54, in gera_graduacao
for r in rows:
  File "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/objects.py", 
line 3039, in __iter__
row = next(self)
  File "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/objects.py", 
line 3014, in __next__
db_row = self.cursor.fetchone()
  File "/home/www-data/py27env/web2py/gluon/contrib/pg8000/core.py", line 947, 
in fetchone
return next(self)
  File "/home/www-data/py27env/web2py/gluon/contrib/pg8000/core.py", line 1032, 
in __next__
self._c.handle_messages(self)
  File "/home/www-data/py27env/web2py/gluon/contrib/pg8000/core.py", line 2088, 
in handle_messages
raise self.error
ProgrammingError: (u'ERROR', u'34000', u'portal "pg8000_portal_11313" does not 
exist', u'postgres.c', u'1861', u'exec_execute_message', u'', u'')


Thanks
Best regards
André

Em domingo, 25 de fevereiro de 2018 21:02:54 UTC-3, Massimo Di Pierro 
escreveu:
>
> If it finds psycopg2 it should be using it over pg8000. Is t possible you 
> have two versions of python installed?
>
>
>
> On Sunday, 25 February 2018 04:46:57 UTC-6, Morganti wrote:
>>
>> Hi Massimo, thanks your answer.
>>
>> How can force web2py uses psycop2? I install pyscop2 using pip and made a 
>> test importing it in normal python shell. But I got the same error when 
>> tried to execute the same function:
>>
>> ((u'ERROR', u'34000', 
>> u'portal "pg8000_portal_294" does not exist', u'postgres.c', u'1861', 
>> u'exec_execute_message', u'', u''))
>>
>> It is using pg8000 and not pyscop2.
>>
>> Thanks,
>> Best regards
>> André
>>
>> Em sábado, 24 de fevereiro de 2018 23:36:32 UTC-3, Massimo Di Pierro 
>> escreveu:
>>>
>>> I know. It is there and we distribute it but we will remove it in the 
>>> next version.
>>> I run into lots of problems with it, even with simple apps. psycopg2 
>>> works instead.
>>>
>>>
>>> On Friday, 23 February 2018 04:57:41 UTC-6, Morganti wrote:

 Hi Dave,

 I found "pg8000" inside "gluon/contrib".

 In "gluon\packages\dal\pydal\adapters" I found the "postgres.py". So is 
 it wrong? Do I need to move pg8000 to "gluon\packages\dal\pydal\adapters"?

 You said about socket. I have no idea how to do it.

 Thanks a lot your support!
 Best regards
 Andre

 Em quinta-feira, 22 de fevereiro de 2018 18:30:17 UTC-3, Dave S 
 escreveu:
>
>
>
> On Thursday, February 22, 2018 at 8:29:43 AM UTC-8, Morganti wrote:
>>
>> Hi, thanks your time.
>>
>> How can I check it? If I try to open web2py shell (web2py -S app -M), 
>> I had no errors and all tables could be used.
>>
>> Thanks 
>> BR
>> André
>>
>>
> That's one way to check.  The actual files should show up in the 
> web2py/gluon/packages/dal/pydal/adapters, I think, and not just in 
> gluon/contrib.
>
>
> But the error looks, to my inexpert eye, like a socket error.  So I 
> would start by verifying the socket exists and has the proper 
> permissions. 
>
> /dps
>
> Em quinta-feira, 22 de fevereiro de 2018 13:08:23 UTC-3, Ovidio 
>> Marinho escreveu:
>>>
>>> make sure the pg8000 and psycopg2 libraries are installed at the 
>>> start of web2py
>>>
>>>
>>>
>>>
>>>
>>>
>>>[image: http://itjp.net.br] 
>>>  http://itjp.net.b r
>>>   *Ovidio Marinho Falcao Neto*
>>>  ovid...@gmail.com
>>> Brasil
>>>  
>>>
>>> 2018-02-22 12:40 GMT-03:00 Morganti :
>>>
 Hello,

 I have a VPS using ubuntu 16.04, nginx, Postgres and web2py 2.16.1.

 I tried to execute one controller that populate some tables and got 
 the error below.

 Then, I used that command to create a csv

Re: [web2py] Re: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
I review my code and found what happen...

Somehow this query :

db()._select(db.table_name.other_table_id,
join=db.table_name.on(db.table_name.other_table_id == db.other_table_name.id
))

Return (2.14.6) :

SELECT table_name.other_table_id FROM other_table_name JOIN table_name ON
(table_name.other_table_id = other_table_name.id);

Now it return (trunk-master and I guess 2.16.1) :

SELECT "table_name"."other_table_id" FROM "other_table_name" CROSS JOIN "
table_name" JOIN "table_name" ON ("table_name"."other_table_id" = "
other_table_name"."id");


I think there is a bug somewhere (pyDAL??), removing the CROSS JOIN
table_name in red above resolve the issue...



On Tue, Feb 27, 2018 at 10:22 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> git clone --recursive https://github.com/web2py/web2py.git
>
> On Tue, Feb 27, 2018 at 10:20 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> git clone --recursive web2py repo http address
>>
>> On Tue, Feb 27, 2018 at 1:29 AM, pbreit  wrote:
>>
>>> Could someone please confirm for me if I can just do a "git pull" or do
>>> I need to do something else to make sure I also get latest DAL?
>>>
>>> --
>>> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
Found that which seems related :
https://groups.google.com/d/msg/web2py/qYgMQ3rhf5E/U6TIDKUlBgAJ

And the initial post refered by villas :
https://groups.google.com/d/msg/web2py/KpxWh4ikqG8/cDBbhiK_3F8J

There is not seems to have any issue being open for this over pyDAL
repository

Richard

On Tue, Feb 27, 2018 at 10:55 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I review my code and found what happen...
>
> Somehow this query :
>
> db()._select(db.table_name.other_table_id, join=db.table_name.on(db.
> table_name.other_table_id == db.other_table_name.id))
>
> Return (2.14.6) :
>
> SELECT table_name.other_table_id FROM other_table_name JOIN table_name ON
> (table_name.other_table_id = other_table_name.id);
>
> Now it return (trunk-master and I guess 2.16.1) :
>
> SELECT "table_name"."other_table_id" FROM "other_table_name" CROSS JOIN "
> table_name" JOIN "table_name" ON ("table_name"."other_table_id" = "
> other_table_name"."id");
>
>
> I think there is a bug somewhere (pyDAL??), removing the CROSS JOIN
> table_name in red above resolve the issue...
>
>
>
> On Tue, Feb 27, 2018 at 10:22 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> git clone --recursive https://github.com/web2py/web2py.git
>>
>> On Tue, Feb 27, 2018 at 10:20 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> git clone --recursive web2py repo http address
>>>
>>> On Tue, Feb 27, 2018 at 1:29 AM, pbreit  wrote:
>>>
 Could someone please confirm for me if I can just do a "git pull" or do
 I need to do something else to make sure I also get latest DAL?

 --
 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: please help us test trunk web2py

2018-02-27 Thread Leonel Câmara
I believe we deprecated empty queries as they caused way too many problems 
and bugs (e.g. common filters don't work).

-- 
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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
CROSS JOIN get included when there is only one tablecolumn asked

db(db.auth_user.id ==
db.auth_membership.user_id).select(db.auth_user.username,
db.auth_membership.group_id)
Out[1]: 

In [2]: db(db.auth_user.id ==
db.auth_membership.user_id)._select(db.auth_user.username,
db.auth_membership.group_id)
Out[2]: 'SELECT "auth_user"."username", "auth_membership"."group_id" FROM
"auth_user", "auth_membership" WHERE ("auth_user"."id" =
"auth_membership"."user_id");'

In [3]: db()._select(db.auth_user.username, db.auth_membership.group_id,
join=db.auth_membership.on(db.auth_user.id == db.auth_membership.user_id))
Out[3]: 'SELECT "auth_user"."username", "auth_membership"."group_id" FROM
"auth_user" JOIN "auth_membership" ON ("auth_user"."id" =
"auth_membership"."user_id");'

In [4]: db()._select(db.auth_membership.group_id,
join=db.auth_membership.on(db.auth_user.id == db.auth_membership.user_id))
Out[4]: 'SELECT "auth_membership"."group_id" FROM "auth_user" CROSS JOIN
"auth_membership" JOIN "auth_membership" ON ("auth_user"."id" =
"auth_membership"."user_id");'


On Tue, Feb 27, 2018 at 11:13 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Found that which seems related :
> https://groups.google.com/d/msg/web2py/qYgMQ3rhf5E/U6TIDKUlBgAJ
>
> And the initial post refered by villas : https://groups.google.com/d/
> msg/web2py/KpxWh4ikqG8/cDBbhiK_3F8J
>
> There is not seems to have any issue being open for this over pyDAL
> repository
>
> Richard
>
> On Tue, Feb 27, 2018 at 10:55 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I review my code and found what happen...
>>
>> Somehow this query :
>>
>> db()._select(db.table_name.other_table_id, join=db.table_name.on(db.table
>> _name.other_table_id == db.other_table_name.id))
>>
>> Return (2.14.6) :
>>
>> SELECT table_name.other_table_id FROM other_table_name JOIN table_name
>> ON (table_name.other_table_id = other_table_name.id);
>>
>> Now it return (trunk-master and I guess 2.16.1) :
>>
>> SELECT "table_name"."other_table_id" FROM "other_table_name" CROSS JOIN "
>> table_name" JOIN "table_name" ON ("table_name"."other_table_id" = "
>> other_table_name"."id");
>>
>>
>> I think there is a bug somewhere (pyDAL??), removing the CROSS JOIN
>> table_name in red above resolve the issue...
>>
>>
>>
>> On Tue, Feb 27, 2018 at 10:22 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> git clone --recursive https://github.com/web2py/web2py.git
>>>
>>> On Tue, Feb 27, 2018 at 10:20 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 git clone --recursive web2py repo http address

 On Tue, Feb 27, 2018 at 1:29 AM, pbreit  wrote:

> Could someone please confirm for me if I can just do a "git pull" or
> do I need to do something else to make sure I also get latest DAL?
>
> --
> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
In [6]: db(db.auth_user.id > 0)._select(db.auth_membership.group_id,
join=db.auth_membership.on(db.auth_user.id == db.auth_membership.user_id))
Out[6]: 'SELECT "auth_membership"."group_id" FROM "auth_user" JOIN
"auth_membership" ON ("auth_user"."id" = "auth_membership"."user_id") WHERE
("auth_user"."id" > 0);'

Seems to solve it...



On Tue, Feb 27, 2018 at 11:58 AM, Leonel Câmara 
wrote:

> I believe we deprecated empty queries as they caused way too many problems
> and bugs (e.g. common filters don't work).
>
> --
> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
@Leonel, I recall about empty query beeing deprecated... But I can't find
any reference to it neither in change log of pyDAL nor web2py change log...
Niether the book...

Which version of the DAL the support been dropped?

Richard



On Tue, Feb 27, 2018 at 12:01 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> In [6]: db(db.auth_user.id > 0)._select(db.auth_membership.group_id,
> join=db.auth_membership.on(db.auth_user.id == db.auth_membership.user_id))
> Out[6]: 'SELECT "auth_membership"."group_id" FROM "auth_user" JOIN
> "auth_membership" ON ("auth_user"."id" = "auth_membership"."user_id") WHERE
> ("auth_user"."id" > 0);'
>
> Seems to solve it...
>
>
>
> On Tue, Feb 27, 2018 at 11:58 AM, Leonel Câmara 
> wrote:
>
>> I believe we deprecated empty queries as they caused way too many
>> problems and bugs (e.g. common filters don't work).
>>
>> --
>> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
Here : https://github.com/web2py/pydal/issues/388

I think the follow up update to the book and change log never occurs...

I am fine with patching my code and make sure I don't leave empty query...
But I am curious to know if this "CROSS JOIN table_name" addition could be
avoid otherwise than providing non empty query... I mean it rough mistake...

Richard

On Tue, Feb 27, 2018 at 12:39 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> @Leonel, I recall about empty query beeing deprecated... But I can't find
> any reference to it neither in change log of pyDAL nor web2py change log...
> Niether the book...
>
> Which version of the DAL the support been dropped?
>
> Richard
>
>
>
> On Tue, Feb 27, 2018 at 12:01 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> In [6]: db(db.auth_user.id > 0)._select(db.auth_membership.group_id,
>> join=db.auth_membership.on(db.auth_user.id ==
>> db.auth_membership.user_id))
>> Out[6]: 'SELECT "auth_membership"."group_id" FROM "auth_user" JOIN
>> "auth_membership" ON ("auth_user"."id" = "auth_membership"."user_id") WHERE
>> ("auth_user"."id" > 0);'
>>
>> Seems to solve it...
>>
>>
>>
>> On Tue, Feb 27, 2018 at 11:58 AM, Leonel Câmara 
>> wrote:
>>
>>> I believe we deprecated empty queries as they caused way too many
>>> problems and bugs (e.g. common filters don't work).
>>>
>>> --
>>> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
At least there is a open issue on the book repo :
https://github.com/web2py/web2py-book/issues/346

On Tue, Feb 27, 2018 at 12:57 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Here : https://github.com/web2py/pydal/issues/388
>
> I think the follow up update to the book and change log never occurs...
>
> I am fine with patching my code and make sure I don't leave empty query...
> But I am curious to know if this "CROSS JOIN table_name" addition could be
> avoid otherwise than providing non empty query... I mean it rough mistake...
>
> Richard
>
> On Tue, Feb 27, 2018 at 12:39 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> @Leonel, I recall about empty query beeing deprecated... But I can't find
>> any reference to it neither in change log of pyDAL nor web2py change log...
>> Niether the book...
>>
>> Which version of the DAL the support been dropped?
>>
>> Richard
>>
>>
>>
>> On Tue, Feb 27, 2018 at 12:01 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> In [6]: db(db.auth_user.id > 0)._select(db.auth_membership.group_id,
>>> join=db.auth_membership.on(db.auth_user.id ==
>>> db.auth_membership.user_id))
>>> Out[6]: 'SELECT "auth_membership"."group_id" FROM "auth_user" JOIN
>>> "auth_membership" ON ("auth_user"."id" = "auth_membership"."user_id") WHERE
>>> ("auth_user"."id" > 0);'
>>>
>>> Seems to solve it...
>>>
>>>
>>>
>>> On Tue, Feb 27, 2018 at 11:58 AM, Leonel Câmara 
>>> wrote:
>>>
 I believe we deprecated empty queries as they caused way too many
 problems and bugs (e.g. common filters don't work).

 --
 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
What causing the CROSS JOIN issue had been introduce between pyDAL 16.11
and 17.01

There is a compare of the 2 :
https://github.com/web2py/pydal/compare/v16.11...v17.01

Richard

On Tue, Feb 27, 2018 at 12:59 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> At least there is a open issue on the book repo :
> https://github.com/web2py/web2py-book/issues/346
>
> On Tue, Feb 27, 2018 at 12:57 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Here : https://github.com/web2py/pydal/issues/388
>>
>> I think the follow up update to the book and change log never occurs...
>>
>> I am fine with patching my code and make sure I don't leave empty
>> query... But I am curious to know if this "CROSS JOIN table_name" addition
>> could be avoid otherwise than providing non empty query... I mean it rough
>> mistake...
>>
>> Richard
>>
>> On Tue, Feb 27, 2018 at 12:39 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> @Leonel, I recall about empty query beeing deprecated... But I can't
>>> find any reference to it neither in change log of pyDAL nor web2py change
>>> log... Niether the book...
>>>
>>> Which version of the DAL the support been dropped?
>>>
>>> Richard
>>>
>>>
>>>
>>> On Tue, Feb 27, 2018 at 12:01 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 In [6]: db(db.auth_user.id > 0)._select(db.auth_membership.group_id,
 join=db.auth_membership.on(db.auth_user.id ==
 db.auth_membership.user_id))
 Out[6]: 'SELECT "auth_membership"."group_id" FROM "auth_user" JOIN
 "auth_membership" ON ("auth_user"."id" = "auth_membership"."user_id") WHERE
 ("auth_user"."id" > 0);'

 Seems to solve it...



 On Tue, Feb 27, 2018 at 11:58 AM, Leonel Câmara >>> > wrote:

> I believe we deprecated empty queries as they caused way too many
> problems and bugs (e.g. common filters don't work).
>
> --
> 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: session var in table decimal field throws error on postgres

2018-02-27 Thread Jordan Ladora
Sure, really not much to see.. not sure if this is what you're asking, but 
I've got the module in the modules folder, and in a model I have-


*from _vars import **
...which throws an error that w2p is unable to find it, so I just use-



*from sys import pathpath append('...web2py/applications/init/modules')*
...and the import is fine. 



On Monday, February 26, 2018 at 5:52:47 PM UTC-7, Anthony wrote:
>
> On Monday, February 26, 2018 at 5:29:46 PM UTC-5, Jordan Ladora wrote:
>>
>> Forgot to reply to this earlier but I ended up putting them in a module 
>> to be imported. 
>>
>> Incidentally, I noticed when importing a module (from outside the regular 
>> system path for python libs) into a model, I needed to append the 
>> app/modules folder path before doing the import.
>>
>
> You should not need to do that. Can we see your exact code?
>
> Anthony
>

-- 
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] selinux users and roles for homemade task queue

2018-02-27 Thread Jordan Ladora
Hi,

I have user apache running w2p, and this user cannot log in, has no 
directory, etc. I also set selinux user mapping for apache on creation to 
further limit what it can do. ie-


*useradd -s /sbin/nologin -d /dev/null -c 'apache webserver' -Z user_u 
apache*
...and I use apache to also start the homemade task queues, eg-


*sudo -u apache nohup python web2py.py -S init -M -R HTQ_script.py*
...this is called by the root user since apache cannot log in. But where 
selinux is concerned, the HTQ script runs as the root user (because the 
root user uses sudo to run the command as apache) and is thus unconfined. 
(see e.g. https://wiki.gentoo.org/wiki/SELinux/Unconfined_domains for why 
this is potentially risky).

i.e.-

# as root

*id -Z*

*unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023*
# as root sudo apache

*sudo -u apache id -Z*

*unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023*

I tried messing around with sudo's '-r' param to set other user roles for 
apache when calling the HTQ script above (like suggested here 
)
 
but couldn't get it to work. I'm also using targeted policy and not MLS so 
that might be part of the issue. I started to look into this deeper but 
really don't want to have to sit down and read a book on selinux to figure 
it all out, and then started to wonder if this matters at all, anyway, and 
thought maybe the best thing to do would be to ask here. So the question 
is, is there any security risk to calling a HTQ script as a selinux 
unconfined user??

Thanks for any help,
jl



-- 
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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
In 17.01

line 627

if join and not left:
cross_joins = iexcluded + list(itables_to_merge)

cross_joins contains both tables involve in the query, which wasn't the
case in 16.11

I follow up and it could come from

helpers.methods.merge_tablempas() (introduced in 17.01) use
in _build_joins_for_select() or it could be caused by this piece of code
included in the former mention function :

tablemap = {}
for item in param:
if isinstance(item, Expression):
item = item.first
key = item._tablename
if tablemap.get(key, item) is not item:
raise ValueError('Name conflict in table list: %s' % key)
tablemap[key] = item

At that point code get difficult to understand what it does...

Should we consider this a flaw in the actual code or  is this issue which
goes away when not doing empty query is related to the difficulty we were
having supporting the empty query syntax???

I guess the answer to this question will resolve this definitely...

Richard

On Tue, Feb 27, 2018 at 2:11 PM, Richard Vézina  wrote:

> What causing the CROSS JOIN issue had been introduce between pyDAL 16.11
> and 17.01
>
> There is a compare of the 2 : https://github.com/web2py/
> pydal/compare/v16.11...v17.01
>
> Richard
>
> On Tue, Feb 27, 2018 at 12:59 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> At least there is a open issue on the book repo :
>> https://github.com/web2py/web2py-book/issues/346
>>
>> On Tue, Feb 27, 2018 at 12:57 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Here : https://github.com/web2py/pydal/issues/388
>>>
>>> I think the follow up update to the book and change log never occurs...
>>>
>>> I am fine with patching my code and make sure I don't leave empty
>>> query... But I am curious to know if this "CROSS JOIN table_name" addition
>>> could be avoid otherwise than providing non empty query... I mean it rough
>>> mistake...
>>>
>>> Richard
>>>
>>> On Tue, Feb 27, 2018 at 12:39 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 @Leonel, I recall about empty query beeing deprecated... But I can't
 find any reference to it neither in change log of pyDAL nor web2py change
 log... Niether the book...

 Which version of the DAL the support been dropped?

 Richard



 On Tue, Feb 27, 2018 at 12:01 PM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> In [6]: db(db.auth_user.id > 0)._select(db.auth_membership.group_id,
> join=db.auth_membership.on(db.auth_user.id ==
> db.auth_membership.user_id))
> Out[6]: 'SELECT "auth_membership"."group_id" FROM "auth_user" JOIN
> "auth_membership" ON ("auth_user"."id" = "auth_membership"."user_id") 
> WHERE
> ("auth_user"."id" > 0);'
>
> Seems to solve it...
>
>
>
> On Tue, Feb 27, 2018 at 11:58 AM, Leonel Câmara <
> leonelcam...@gmail.com> wrote:
>
>> I believe we deprecated empty queries as they caused way too many
>> problems and bugs (e.g. common filters don't work).
>>
>> --
>> 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: please help us test trunk web2py

2018-02-27 Thread Richard Vézina
Out of _build_joins_for_select() itables_to_merge variable has only one
table which is the one implicated in the join (in this case "auth_user")...
But another merge_tablemaps() occurs in red below :

if join:
(
# FIXME? ijoin_tables is never used
ijoin_tables, ijoin_on, itables_to_merge, ijoin_on_tables,
iimportant_tablenames, iexcluded, itablemap
) = self._build_joins_for_select(tablemap, join)
tablemap = merge_tablemaps(tablemap, itables_to_merge)
tablemap = merge_tablemaps(tablemap, itablemap)
if left:
(
join_tables, join_on, tables_to_merge, join_on_tables,
important_tablenames, excluded, jtablemap
) = self._build_joins_for_select(tablemap, left)
tablemap = merge_tablemaps(tablemap, tables_to_merge)
tablemap = merge_tablemaps(tablemap, jtablemap)


So itables_to_merge get altered and get back to is previous state as it is
at some point in _build_joins_for_select() (in red), but it was filtered in
the stage in blue  :

def _build_joins_for_select(self, tablenames, param):
if not isinstance(param, (tuple, list)):
param = [param]
tablemap = {}
for item in param:
if isinstance(item, Expression):
item = item.first
key = item._tablename
if tablemap.get(key, item) is not item:
raise ValueError('Name conflict in table list: %s' % key)
tablemap[key] = item
join_tables = [
t._tablename for t in param if not isinstance(t, Expression)
]
join_on = [t for t in param if isinstance(t, Expression)]
tables_to_merge = {}
for t in join_on:
tables_to_merge = merge_tablemaps(tables_to_merge,
self.tables(t))
join_on_tables = [t.first._tablename for t in join_on]
for t in join_on_tables:
print t
if t in tables_to_merge:
print t
tables_to_merge.pop(t)
important_tablenames = join_tables + join_on_tables + \
list(tables_to_merge)
excluded = [
t for t in tablenames if t not in important_tablenames
]
return (
join_tables, join_on, tables_to_merge, join_on_tables,
important_tablenames, excluded, tablemap
)


With the logic in merge_tablemaps() where things are reversed in big and
small and big get update at the end it explains why itables_to_merge get
modified by merge_tablemaps()

def merge_tablemaps(*maplist):
"""Merge arguments into a single dict, check for name collisions.
Arguments may be modified in the process."""
ret = maplist[0]
for item in maplist[1:]:
if len(ret) > len(item):
big, small = ret, item
else:
big, small = item, ret
# Check for name collisions
for key, val in small.items():
if big.get(key, val) is not val:
raise ValueError('Name conflict in table list: %s' % key)
# Merge
big.update(small)
ret = big
return ret

I don't think itables_to_merge is updated intentionally because why
filtering it in _build_joins_for_select()...

My guess is the intention wasn't to get it updated and the only purpose of
the  tablemap with all the tables names as itablemap use lack some(s) of
them...

So deepcopy would be need it or just dict(**itables_to_merge)) while
passing itables_to_merge to merge_tablemaps()

*Should we fix that??*

if join:
(
# FIXME? ijoin_tables is never used
ijoin_tables, ijoin_on, itables_to_merge, ijoin_on_tables,
iimportant_tablenames, iexcluded, itablemap
) = self._build_joins_for_select(tablemap, join)
tablemap = merge_tablemaps(tablemap, dict(**itables_to_merge))
tablemap = merge_tablemaps(tablemap, itablemap)
if left:
(
join_tables, join_on, tables_to_merge, join_on_tables,
important_tablenames, excluded, jtablemap
) = self._build_joins_for_select(tablemap, left)
tablemap = merge_tablemaps(tablemap, dict(**tables_to_merge))
tablemap = merge_tablemaps(tablemap, jtablemap)



On Tue, Feb 27, 2018 at 4:30 PM, Richard Vézina  wrote:

> In 17.01
>
> line 627
>
> if join and not left:
> cross_joins = iexcluded + list(itables_to_merge)
>
> cross_joins contains both tables involve in the query, which wasn't the
> case in 16.11
>
> I follow up and it could come from
>
> helpers.methods.merge_tablempas() (introduced in 17.01) use
> in _build_joins_for_select() or it could be caused by this piece of code
> included in the former mention function :
>
> tablemap = {}
> for item in param:
> if isinstance(item, Expression):
>

[web2py] compiling application ?

2018-02-27 Thread Yoel Benitez Fonseca
Is there a way of compiling a web2py application from the command line ?

-- 
Msc. Yoel Benítez Fonseca

-- 
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: cert-based logins

2018-02-27 Thread Dave S


On Thursday, February 8, 2018 at 12:01:05 AM UTC-8, Dave S wrote:
>
> I'm considering using cert-based logins for privileged users, and staying 
> with basic login for less privileged users (the privilege itself is managed 
> by using auth_groups).
>
>
Any additional thoughts about this?

 

> In the book, at
>  http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms
> >
> the sub-paragraph for X509 concludes with
> "This works out of the box with Rocket (the web2py built-in web server) 
> but you may need some extra configuration work on the web server side if 
> you are using a different web server. In particular you need to tell your 
> web server where the certificates are located on local host and that it 
> needs to verify certificates coming from the clients. How to do it is web 
> server dependent and therefore omitted here."
>
> This blog entry seems to describe what I need, which is for nginx; so do I 
> have the omitted how-to covered?
>  https://arcweb.co/securing-websites-nginx-and-client-side-certificate-authentication-linux/
> >
>
> In my case, the less privileged users will usually be using a libcurl call 
> to transfer error information to my server, and only occasionally using a 
> web page via browser to do the same task.  Privileged users will mostly be 
> using browsers, and only occasionally going through the call/api method.
>
> The book goes on to talk about multiple login forms.  I'm a little unclear 
> about how "signals are set in the request", and what would be the 
> appropriate signal for a cert.
>
> Thanks.
>
> Dave S
> /dps
>
>
>

-- 
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.