Re: [web2py] Re: two Database syncrho

2020-07-04 Thread Carlos Correia

Às 06:14 de 01/07/20, Massimo Di Pierro escreveu:
Yes. Only on PostgreSQL, MySQL and Firebird. Assuming the feature has not been 
broken over time, I do not know of anybody who used it.


On Thursday, 11 June 2020 12:51:48 UTC-7, Ari Lion BR Sp wrote:

Hi to all,

I am trying to  understand how to use the below feature:

DAL.distributed_transaction_commit(db_a,  db_b)

mentined here:

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Distributed-transaction



Does web2py does the synchro work, through DAL?

Thanks!



Hi, Massimo,

It seems to be broken :(


I have this piece of code in a controller to test a distributed transaction but 
it fails with: "ValueError: need more than 0 values to unpack". def index():

response.flash = T("Hello World")
db0 = DAL('postgres://belmiro:naosei@localhost/ennos__blm_0139' )
db1 = DAL('postgres://belmiro:naosei@localhost/ennos__blm_0143' )
DAL.distributed_transaction_begin( db0, db1 )
db0.auth_event.insert(description='test tx 0' )
db1.auth_event.insert(description='test tx 1' )
DAL.distributed_transaction_commit( db0, db1 )
return dict(message=T('Welcome to web2py!'))

Stack trace:
File ".../web2py/applications/welcome/controllers/default.py" 
, line 12, 
in index DAL.distributed_transaction_begin( db0, db1 ) File 
".../web2py/gluon/packages/dal/pydal/base.py", line 341, in 
distributed_transaction_begin keys = ['%s.%i' % (thread_key, i) for (i, db) in 
instances]


Best regards,


Carlos Correia
=
MEMÓRIA PERSISTENTE
GSM:  917 157 146 (Signal, WhatsApp)
e-mail: ge...@memoriapersistente.pt
URL: http://www.memoriapersistente.pt
XMPP (Jabber): car...@memoriapersistente.pt
GnuPG: wwwkeys.eu.pgp.net

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d16f102e-0821-d8a1-d8ff-20c67bdbce85%40memoriapersistente.pt.


Re: [web2py] Re: two Database syncrho

2020-07-04 Thread Carlos Correia

Às 13:28 de 04/07/20, Carlos Correia escreveu:

Às 06:14 de 01/07/20, Massimo Di Pierro escreveu:
Yes. Only on PostgreSQL, MySQL and Firebird. Assuming the feature has not 
been broken over time, I do not know of anybody who used it.


On Thursday, 11 June 2020 12:51:48 UTC-7, Ari Lion BR Sp wrote:

Hi to all,

I am trying to  understand how to use the below feature:

DAL.distributed_transaction_commit(db_a,  db_b)

mentined here:

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Distributed-transaction



Does web2py does the synchro work, through DAL?

Thanks!



Hi, Massimo,

It seems to be broken :(


I have this piece of code in a controller to test a distributed transaction 
but it fails with: "ValueError: need more than 0 values to unpack". def index():

 response.flash = T("Hello World")
 db0 = DAL('postgres://belmiro:naosei@localhost/ennos__blm_0139' )
 db1 = DAL('postgres://belmiro:naosei@localhost/ennos__blm_0143' )
 DAL.distributed_transaction_begin( db0, db1 )
 db0.auth_event.insert(description='test tx 0' )
 db1.auth_event.insert(description='test tx 1' )
 DAL.distributed_transaction_commit( db0, db1 )
 return dict(message=T('Welcome to web2py!'))

Stack trace:
File ".../web2py/applications/welcome/controllers/default.py" 
, line 
12, in index DAL.distributed_transaction_begin( db0, db1 ) File 
".../web2py/gluon/packages/dal/pydal/base.py", line 341, in 
distributed_transaction_begin keys = ['%s.%i' % (thread_key, i) for (i, db) in 
instances]


Best regards,



Indeed it has a bug in gluon/packages/dal/pydal/base.py at lines 341 and 342, 
which should be switched.


341 keys = ['%s.%i' % (thread_key, i) for (i, db) in instances]
342 instances = enumerate(instances)

should be:

341     instances = enumerate(instances)
342     keys = ['%s.%i' % (thread_key, i) for (i, db) in instances]

I switched the lines, tested, and it worked as expected. Shall I open an issue 
on Github?



Best regards,


Carlos Correia
=
MEMÓRIA PERSISTENTE
GSM:  917 157 146 (Signal, WhatsApp)
e-mail: ge...@memoriapersistente.pt
URL: http://www.memoriapersistente.pt
XMPP (Jabber): car...@memoriapersistente.pt
GnuPG: wwwkeys.eu.pgp.net

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0bd99e21-2f16-891c-1393-2b4ed260ec6d%40memoriapersistente.pt.


Re: [web2py] Problem starting a distributed transaction

2020-07-04 Thread Carlos Correia

Às 14:40 de 03/07/20, Carlos Correia escreveu:
Hi, I have this piece of code in a controller to test a distributed 
transaction but it fails with: "ValueError: need more than 0 values to 
unpack". def index():

 response.flash = T("Hello World")
 db0 = DAL('postgres://belmiro:naosei@localhost/ennos__blm_0139' )
 db1 = DAL('postgres://belmiro:naosei@localhost/ennos__blm_0143' )
 DAL.distributed_transaction_begin( db0, db1 )
 db0.auth_event.insert(description='test tx 0' )
 db1.auth_event.insert(description='test tx 1' )
 DAL.distributed_transaction_commit( db0, db1 )
 return dict(message=T('Welcome to web2py!'))

Stack trace:
File ".../web2py/applications/welcome/controllers/default.py" 
, line 
12, in index DAL.distributed_transaction_begin( db0, db1 ) File 
".../web2py/gluon/packages/dal/pydal/base.py", line 341, in 
distributed_transaction_begin keys = ['%s.%i' % (thread_key, i) for (i, db) in 
instances]

What I am doing wrong?


Hi,

It has a bug in gluon/packages/dal/pydal/base.py at lines 341 and 342, which 
should be switched.


341 keys = ['%s.%i' % (thread_key, i) for (i, db) in instances]
342 instances = enumerate(instances)

should be:

341     instances = enumerate(instances)
342     keys = ['%s.%i' % (thread_key, i) for (i, db) in instances]

I switched the lines, tested, and it worked as expected.



Best regards,


Carlos Correia
=
MEMÓRIA PERSISTENTE
GSM:  917 157 146 (Signal, WhatsApp)
e-mail: ge...@memoriapersistente.pt
URL: http://www.memoriapersistente.pt
XMPP (Jabber): car...@memoriapersistente.pt
GnuPG: wwwkeys.eu.pgp.net

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c3208edf-5c9b-dbef-cc92-cf81ddb42f1d%40memoriapersistente.pt.


[web2py] Re: Navigation to /appadmin returns "invalid function (default/index)"

2020-07-04 Thread E T Bear
Thanks, but, I didn't get 2.20.4-stable from github, I installed it via the 
web2py administrative interface (which I can no longer access).  My version 
of those three files matches the pre-commit version.

The problem persists.  I can access my application, and the Welcome 
application, but not any admin pages.


On Tuesday, June 30, 2020 at 10:19:04 PM UTC-7, Massimo Di Pierro wrote:
>
> Did you get it from github?
> There was a recent change that maybe could have caused this:
>
>
> https://github.com/web2py/web2py/commit/cf76978a390a70dfc36d3bfe64818fc0cc7226f3
>
> Could you please revert it and see if it fixes your problem?
>
> On Thursday, 25 June 2020 16:53:53 UTC-7, E T Bear wrote:
>>
>> Running on an Ubuntu 16.04 LTS system, under Nginx server with WSGI 
>> handler wsgihandler.py.  Web2py updated to 2.20.4-stable.  Using a 
>> PostgreSQL database.
>>
>> Suddenly, I can't navigate to /appadmin nor to /admin/..., get errors 
>> like  "invalid function (default/index)" remotely over SSL, nor locally.  
>> My own application continues to run well.
>>
>> Had no such problem before, running for several years.  Not sure when the 
>> problem started since I don't visit /admin that often.  On my desktop 
>> (running under Rocket) there's no such problem.  I have copied the whole 
>> directory structure down from the server for comparison, and it is 
>> identical to the version that lets me visit /appadmin on my desktop.
>>
>> It seems like a routing problem, admin/index never seems to get hit, but 
>> my routes.py has not changed (my application is 'myapp' here):
>>
>> routers = dict(
>> BASE = dict(
>> default_application='myapp',
>> )
>> )
>>
>> Any clue or hint for where to look will be greatly appreciated.
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/92e633ef-7c6f-4011-ada1-7d024098cd2co%40googlegroups.com.