Re: [web2py] standalone templates

2019-01-23 Thread Carlos Cesar Caballero Díaz
Basically web2py injects to the template things like html helpers and 
response or request objects, I just want to find how this is done, for 
example, the jinja2 templates has the Environment.globals list for 
include objects in the template context, I am looking for a 
functionality like that in the web2py templates.


Greetings.

El 23/1/19 a las 9:36 a.m., sandeep patel escribió:

Thanks for clarification @Carloas,
You can extend the template module classes. According to your need 
then you can inject whatever object you want as a default.

Please correct me if I am in the wrong direction

 Thanks
SP

On Wed, Jan 23, 2019 at 7:42 PM Carlos Cesar Caballero Díaz 
> wrote:


Hi sandeep patel, thanks for your answer.

In my use case I am using the template module outside web2py as a
standalone package, and I need to inject some objects in the
template by default. I am not using the whole web2py framework.

Greetings.

El 23/1/19 a las 8:58 a.m., sandeep patel escribió:

@ Carlos
I think you can use the current app modules folder. This executes
all the .py files on the top label of every request
For more information here



Thanks
SP

On Wed, Jan 23, 2019 at 6:39 PM Carlos Cesar Caballero Díaz
mailto:carlos.caball...@cfg.jovenclub.cu>> wrote:

Hi guys, I am using the web2py templates in a side project
and I want to
include some variables in the environment by default,
something like how
helpers, request and response are included in the framework,
but I can't
find how this is done. Any idea?

Greetings.


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


--
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] adding fields dynamically in web2y forms

2019-01-23 Thread mostwanted
I have a little invoice page in my app, but i also want people to be able 
to invoice as many things as possible at once without having to keep saving 
so many times, this is what i used:

*MODEL*
db.define_table("invoice", 
Field("product", "list:string"),
Field("price", "list:integer"),
format='%(product)s')

In my view i want these details displayed in an html table but they appear 
in list format, how do i remove them from the list to display them 
individually na d how do i sum up those in my price field?

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] Re: decremental subtraction of values in DB field

2019-01-23 Thread Anthony

>
> db.fuelLogging._before_update.append(fuelLogging_before_update())
>

It's a callback function, so you should not be calling it yourself. Just 
append the function (without calling):

db.fuelLogging._before_update.append(fuelLogging_before_update)

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.


Re: [web2py] standalone templates

2019-01-23 Thread sandeep patel
Thanks for clarification @Carloas,
You can extend the template module classes. According to your need then you
can inject whatever object you want as a default.
Please correct me if I am in the wrong direction

 Thanks
SP

On Wed, Jan 23, 2019 at 7:42 PM Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Hi sandeep patel, thanks for your answer.
>
> In my use case I am using the template module outside web2py as a
> standalone package, and I need to inject some objects in the template by
> default. I am not using the whole web2py framework.
>
> Greetings.
> El 23/1/19 a las 8:58 a.m., sandeep patel escribió:
>
> @ Carlos
> I think you can use the current app modules folder. This executes all the
> .py files on the top label of every request
> For more information here
> 
>
> Thanks
> SP
>
> On Wed, Jan 23, 2019 at 6:39 PM Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Hi guys, I am using the web2py templates in a side project and I want to
>> include some variables in the environment by default, something like how
>> helpers, request and response are included in the framework, but I can't
>> find how this is done. Any idea?
>>
>> Greetings.
>>
>>
>> --
>> 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.
>
> --
> 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] standalone templates

2019-01-23 Thread Carlos Cesar Caballero Díaz

Hi sandeep patel, thanks for your answer.

In my use case I am using the template module outside web2py as a 
standalone package, and I need to inject some objects in the template by 
default. I am not using the whole web2py framework.


Greetings.

El 23/1/19 a las 8:58 a.m., sandeep patel escribió:

@ Carlos
I think you can use the current app modules folder. This executes all 
the .py files on the top label of every request
For more information here 



Thanks
SP

On Wed, Jan 23, 2019 at 6:39 PM Carlos Cesar Caballero Díaz 
> wrote:


Hi guys, I am using the web2py templates in a side project and I
want to
include some variables in the environment by default, something
like how
helpers, request and response are included in the framework, but I
can't
find how this is done. Any idea?

Greetings.


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


--
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] standalone templates

2019-01-23 Thread sandeep patel
@ Carlos
I think you can use the current app modules folder. This executes all the
.py files on the top label of every request
For more information here


Thanks
SP

On Wed, Jan 23, 2019 at 6:39 PM Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Hi guys, I am using the web2py templates in a side project and I want to
> include some variables in the environment by default, something like how
> helpers, request and response are included in the framework, but I can't
> find how this is done. Any idea?
>
> Greetings.
>
>
> --
> 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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Massimiliano
When psycopg is available web2py will use it when is not it use pg8000 that
was included in web2py

Il giorno mer 23 gen 2019 alle 14:05 Lisandro 
ha scritto:

> Thank you all for that notes.
>
> When I run web2py at my server, I see this available drivers: sqlite3,
> imaplib, pymysql, pg8000
> I don't see psycopg2, so I presume it will be available if I uninstall
> those two versions and install the psycopg2-binary version.
>
> One additional question: which driver is using my app then?
> I mean, right now my application is connecting directly to PostgreSQL
> without problems. Would this mean it is using the pg8000 driver? Would
> psycopg2 be available to web2py once I reinstall it (restarting uwsgi)?
>
>
>
> El miércoles, 23 de enero de 2019, 7:54:37 (UTC-3), Massimiliano escribió:
>>
>> Try to uninstall psycopg2-* and reinstall only psycopg2-binary
>>
>> On Wed, Jan 23, 2019 at 11:52 AM Massimiliano  wrote:
>>
>>> Could be.
>>>
>>> When you strart web2py it show database driver available:
>>> Mine:
>>> Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000,
>>> pyodbc, pymongo
>>>
>>>
>>>
>>>
>>> On Wed, Jan 23, 2019 at 10:59 AM Lisandro  wrote:
>>>
 Thanks Massimiliano.

 Apparently psycopg2 is already installed (of course it was already
 installed, maybe something broke during the packages upgrade).
 Something weird is that I see psycopg2 installed twice, is this correct?

 ~$ pip freeze | grep psycopg2
 psycopg2==2.7.5
 psycopg2-binary==2.7.5

 Could this be the source of the problem?
 I don't see how. For what I understand, using or not using pgBouncer in
 the middle is transparent to the web2py application: it always connects in
 the same way, the application doesn't know if its connecting to PostgreSQL
 or pgBouncer. I think that's the whole idea of pgBouncer, to act as a
 middle man, pooling connections, behaving as if the application was
 connected directly to PostgreSQL.

 Any comment or suggestion will be much appreciated.

 El miércoles, 23 de enero de 2019, 6:51:06 (UTC-3), Massimiliano
 escribió:
>
> Have you tried to install psycopg2? Is the standard de facto
> postgresql driver.
> The pip package should be psycopg2-binary
>
> On Wed, Jan 23, 2019 at 10:39 AM Lisandro 
> wrote:
>
>> Hi there! Yesterday I had a MAJOR downtime and I would need your help
>> to understand what happened.
>>
>> The team that is in charge of upgrading security packages at my
>> server (CentOS 7 at Linode) did an update that involved an upgrade to
>> pgBouncer. Accordingly to what they said, they noticed pgBouncer was
>> throwing errors after the upgrade, so they downgraded to the previous
>> version that was installed. But sadly the problem remained. After this
>> upgrade/downgrade of pgBouncer, all the attempts of connecting from my
>> web2py app to pgBouncer fail.
>>
>> Inside of postgresql.log I can see lot of this:
>> 2019-01-22 14:39:37 -03 ERROR:  prepared statement
>> «pg8000_statement_0» already exists
>> 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
>> 2019-01-22 14:39:38 -03 ERROR:  prepared statement
>> «pg8000_statement_0» already exists
>> 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction
>>
>> I've noticed that "pg8000_statement_0" is referenced at line 1894 in
>> gluon/contrib/pg8000/core.py, but I can't realise if there is something I
>> could do to avoid the error.
>> I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25,
>> and I've noticed that gluon/contrib/pg8000/core.py isn't anymore in 
>> version
>> 2.17.1.
>>
>> Of course I've tried restarting al the involved services, but nothing
>> worked. Every time my web2py application tries to connect to the 
>> database,
>> if pgBouncer is at the middle, the 5 attempts fail and those lines are
>> printed to the postgresql.log. Right now I've bypassed pgbouncer and my
>> application is connecting directly to postgresql.
>>
>> Could you put some lights into this? What can I do to avoid that
>> error and still connect to pgBouncer with web2py 2.16.1?
>>
>> Thank you very much in advance.
>> Regards, Lisandro.
>>
>> --
>> 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.
>>
>
>
> --
> Massimiliano
>
 --
 Resources:
 - 

[web2py] standalone templates

2019-01-23 Thread Carlos Cesar Caballero Díaz
Hi guys, I am using the web2py templates in a side project and I want to 
include some variables in the environment by default, something like how 
helpers, request and response are included in the framework, but I can't 
find how this is done. Any idea?


Greetings.


--
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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Lisandro
Thank you all for that notes.

When I run web2py at my server, I see this available drivers: sqlite3, 
imaplib, pymysql, pg8000
I don't see psycopg2, so I presume it will be available if I uninstall 
those two versions and install the psycopg2-binary version.

One additional question: which driver is using my app then?
I mean, right now my application is connecting directly to PostgreSQL 
without problems. Would this mean it is using the pg8000 driver? Would 
psycopg2 be available to web2py once I reinstall it (restarting uwsgi)?



El miércoles, 23 de enero de 2019, 7:54:37 (UTC-3), Massimiliano escribió:
>
> Try to uninstall psycopg2-* and reinstall only psycopg2-binary
>
> On Wed, Jan 23, 2019 at 11:52 AM Massimiliano  > wrote:
>
>> Could be.
>>
>> When you strart web2py it show database driver available:
>> Mine:
>> Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, 
>> pyodbc, pymongo 
>>
>>
>>
>>
>> On Wed, Jan 23, 2019 at 10:59 AM Lisandro > > wrote:
>>
>>> Thanks Massimiliano.
>>>
>>> Apparently psycopg2 is already installed (of course it was already 
>>> installed, maybe something broke during the packages upgrade).
>>> Something weird is that I see psycopg2 installed twice, is this correct?
>>>
>>> ~$ pip freeze | grep psycopg2
>>> psycopg2==2.7.5
>>> psycopg2-binary==2.7.5
>>>
>>> Could this be the source of the problem?
>>> I don't see how. For what I understand, using or not using pgBouncer in 
>>> the middle is transparent to the web2py application: it always connects in 
>>> the same way, the application doesn't know if its connecting to PostgreSQL 
>>> or pgBouncer. I think that's the whole idea of pgBouncer, to act as a 
>>> middle man, pooling connections, behaving as if the application was 
>>> connected directly to PostgreSQL.
>>>
>>> Any comment or suggestion will be much appreciated.
>>>
>>> El miércoles, 23 de enero de 2019, 6:51:06 (UTC-3), Massimiliano 
>>> escribió:

 Have you tried to install psycopg2? Is the standard de facto postgresql 
 driver.
 The pip package should be psycopg2-binary

 On Wed, Jan 23, 2019 at 10:39 AM Lisandro  
 wrote:

> Hi there! Yesterday I had a MAJOR downtime and I would need your help 
> to understand what happened.
>
> The team that is in charge of upgrading security packages at my server 
> (CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer. 
> Accordingly to what they said, they noticed pgBouncer was throwing errors 
> after the upgrade, so they downgraded to the previous version that was 
> installed. But sadly the problem remained. After this upgrade/downgrade 
> of 
> pgBouncer, all the attempts of connecting from my web2py app to pgBouncer 
> fail. 
>
> Inside of postgresql.log I can see lot of this:
> 2019-01-22 14:39:37 -03 ERROR:  prepared statement 
> «pg8000_statement_0» already exists
> 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
> 2019-01-22 14:39:38 -03 ERROR:  prepared statement 
> «pg8000_statement_0» already exists
> 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction
>
> I've noticed that "pg8000_statement_0" is referenced at line 1894 in 
> gluon/contrib/pg8000/core.py, but I can't realise if there is something I 
> could do to avoid the error. 
> I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25, 
> and I've noticed that gluon/contrib/pg8000/core.py isn't anymore in 
> version 
> 2.17.1.
>
> Of course I've tried restarting al the involved services, but nothing 
> worked. Every time my web2py application tries to connect to the 
> database, 
> if pgBouncer is at the middle, the 5 attempts fail and those lines are 
> printed to the postgresql.log. Right now I've bypassed pgbouncer and my 
> application is connecting directly to postgresql.
>
> Could you put some lights into this? What can I do to avoid that error 
> and still connect to pgBouncer with web2py 2.16.1?
>
> Thank you very much in advance.
> Regards, Lisandro.
>
> -- 
> 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.
>


 -- 
 Massimiliano

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

Re: [web2py] Error: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Massimiliano
Try to uninstall psycopg2-* and reinstall only psycopg2-binary

On Wed, Jan 23, 2019 at 11:52 AM Massimiliano  wrote:

> Could be.
>
> When you strart web2py it show database driver available:
> Mine:
> Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000,
> pyodbc, pymongo
>
>
>
>
> On Wed, Jan 23, 2019 at 10:59 AM Lisandro 
> wrote:
>
>> Thanks Massimiliano.
>>
>> Apparently psycopg2 is already installed (of course it was already
>> installed, maybe something broke during the packages upgrade).
>> Something weird is that I see psycopg2 installed twice, is this correct?
>>
>> ~$ pip freeze | grep psycopg2
>> psycopg2==2.7.5
>> psycopg2-binary==2.7.5
>>
>> Could this be the source of the problem?
>> I don't see how. For what I understand, using or not using pgBouncer in
>> the middle is transparent to the web2py application: it always connects in
>> the same way, the application doesn't know if its connecting to PostgreSQL
>> or pgBouncer. I think that's the whole idea of pgBouncer, to act as a
>> middle man, pooling connections, behaving as if the application was
>> connected directly to PostgreSQL.
>>
>> Any comment or suggestion will be much appreciated.
>>
>> El miércoles, 23 de enero de 2019, 6:51:06 (UTC-3), Massimiliano escribió:
>>>
>>> Have you tried to install psycopg2? Is the standard de facto postgresql
>>> driver.
>>> The pip package should be psycopg2-binary
>>>
>>> On Wed, Jan 23, 2019 at 10:39 AM Lisandro  wrote:
>>>
 Hi there! Yesterday I had a MAJOR downtime and I would need your help
 to understand what happened.

 The team that is in charge of upgrading security packages at my server
 (CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer.
 Accordingly to what they said, they noticed pgBouncer was throwing errors
 after the upgrade, so they downgraded to the previous version that was
 installed. But sadly the problem remained. After this upgrade/downgrade of
 pgBouncer, all the attempts of connecting from my web2py app to pgBouncer
 fail.

 Inside of postgresql.log I can see lot of this:
 2019-01-22 14:39:37 -03 ERROR:  prepared statement «pg8000_statement_0»
 already exists
 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
 2019-01-22 14:39:38 -03 ERROR:  prepared statement «pg8000_statement_0»
 already exists
 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction

 I've noticed that "pg8000_statement_0" is referenced at line 1894 in
 gluon/contrib/pg8000/core.py, but I can't realise if there is something I
 could do to avoid the error.
 I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25,
 and I've noticed that gluon/contrib/pg8000/core.py isn't anymore in version
 2.17.1.

 Of course I've tried restarting al the involved services, but nothing
 worked. Every time my web2py application tries to connect to the database,
 if pgBouncer is at the middle, the 5 attempts fail and those lines are
 printed to the postgresql.log. Right now I've bypassed pgbouncer and my
 application is connecting directly to postgresql.

 Could you put some lights into this? What can I do to avoid that error
 and still connect to pgBouncer with web2py 2.16.1?

 Thank you very much in advance.
 Regards, Lisandro.

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

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


-- 
Massimiliano

-- 
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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread 黄祥
perhaps this conversation can give a hint:
https://github.com/DataDog/dd-agent/issues/2755

did you backup the server before upgrade?

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] Error: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Massimiliano
Could be.

When you strart web2py it show database driver available:
Mine:
Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000,
pyodbc, pymongo




On Wed, Jan 23, 2019 at 10:59 AM Lisandro 
wrote:

> Thanks Massimiliano.
>
> Apparently psycopg2 is already installed (of course it was already
> installed, maybe something broke during the packages upgrade).
> Something weird is that I see psycopg2 installed twice, is this correct?
>
> ~$ pip freeze | grep psycopg2
> psycopg2==2.7.5
> psycopg2-binary==2.7.5
>
> Could this be the source of the problem?
> I don't see how. For what I understand, using or not using pgBouncer in
> the middle is transparent to the web2py application: it always connects in
> the same way, the application doesn't know if its connecting to PostgreSQL
> or pgBouncer. I think that's the whole idea of pgBouncer, to act as a
> middle man, pooling connections, behaving as if the application was
> connected directly to PostgreSQL.
>
> Any comment or suggestion will be much appreciated.
>
> El miércoles, 23 de enero de 2019, 6:51:06 (UTC-3), Massimiliano escribió:
>>
>> Have you tried to install psycopg2? Is the standard de facto postgresql
>> driver.
>> The pip package should be psycopg2-binary
>>
>> On Wed, Jan 23, 2019 at 10:39 AM Lisandro  wrote:
>>
>>> Hi there! Yesterday I had a MAJOR downtime and I would need your help to
>>> understand what happened.
>>>
>>> The team that is in charge of upgrading security packages at my server
>>> (CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer.
>>> Accordingly to what they said, they noticed pgBouncer was throwing errors
>>> after the upgrade, so they downgraded to the previous version that was
>>> installed. But sadly the problem remained. After this upgrade/downgrade of
>>> pgBouncer, all the attempts of connecting from my web2py app to pgBouncer
>>> fail.
>>>
>>> Inside of postgresql.log I can see lot of this:
>>> 2019-01-22 14:39:37 -03 ERROR:  prepared statement «pg8000_statement_0»
>>> already exists
>>> 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
>>> 2019-01-22 14:39:38 -03 ERROR:  prepared statement «pg8000_statement_0»
>>> already exists
>>> 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction
>>>
>>> I've noticed that "pg8000_statement_0" is referenced at line 1894 in
>>> gluon/contrib/pg8000/core.py, but I can't realise if there is something I
>>> could do to avoid the error.
>>> I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25,
>>> and I've noticed that gluon/contrib/pg8000/core.py isn't anymore in version
>>> 2.17.1.
>>>
>>> Of course I've tried restarting al the involved services, but nothing
>>> worked. Every time my web2py application tries to connect to the database,
>>> if pgBouncer is at the middle, the 5 attempts fail and those lines are
>>> printed to the postgresql.log. Right now I've bypassed pgbouncer and my
>>> application is connecting directly to postgresql.
>>>
>>> Could you put some lights into this? What can I do to avoid that error
>>> and still connect to pgBouncer with web2py 2.16.1?
>>>
>>> Thank you very much in advance.
>>> Regards, Lisandro.
>>>
>>> --
>>> 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.
>>>
>>
>>
>> --
>> Massimiliano
>>
> --
> 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.
>


-- 
Massimiliano

-- 
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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Lisandro
Another weird stuff I noticed: in my server, if I open a terminal, run 
python and try to import psycopg2, I receive an error:

>>> import psycopg2
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 50, 
in 
from psycopg2._psycopg import ( # noqa
ImportError: /usr/lib64/python2.7/site-packages/psycopg2/_psycopg.so: 
undefined symbol: PQconninfo

Does it mean that psycopg2 is broken? If that's the case, how can my 
application still be running? I'm pretty lost. 


El miércoles, 23 de enero de 2019, 6:58:57 (UTC-3), Lisandro escribió:
>
> Thanks Massimiliano.
>
> Apparently psycopg2 is already installed (of course it was already 
> installed, maybe something broke during the packages upgrade).
> Something weird is that I see psycopg2 installed twice, is this correct?
>
> ~$ pip freeze | grep psycopg2
> psycopg2==2.7.5
> psycopg2-binary==2.7.5
>
> Could this be the source of the problem?
> I don't see how. For what I understand, using or not using pgBouncer in 
> the middle is transparent to the web2py application: it always connects in 
> the same way, the application doesn't know if its connecting to PostgreSQL 
> or pgBouncer. I think that's the whole idea of pgBouncer, to act as a 
> middle man, pooling connections, behaving as if the application was 
> connected directly to PostgreSQL.
>
> Any comment or suggestion will be much appreciated.
>
> El miércoles, 23 de enero de 2019, 6:51:06 (UTC-3), Massimiliano escribió:
>>
>> Have you tried to install psycopg2? Is the standard de facto postgresql 
>> driver.
>> The pip package should be psycopg2-binary
>>
>> On Wed, Jan 23, 2019 at 10:39 AM Lisandro  wrote:
>>
>>> Hi there! Yesterday I had a MAJOR downtime and I would need your help to 
>>> understand what happened.
>>>
>>> The team that is in charge of upgrading security packages at my server 
>>> (CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer. 
>>> Accordingly to what they said, they noticed pgBouncer was throwing errors 
>>> after the upgrade, so they downgraded to the previous version that was 
>>> installed. But sadly the problem remained. After this upgrade/downgrade of 
>>> pgBouncer, all the attempts of connecting from my web2py app to pgBouncer 
>>> fail. 
>>>
>>> Inside of postgresql.log I can see lot of this:
>>> 2019-01-22 14:39:37 -03 ERROR:  prepared statement «pg8000_statement_0» 
>>> already exists
>>> 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
>>> 2019-01-22 14:39:38 -03 ERROR:  prepared statement «pg8000_statement_0» 
>>> already exists
>>> 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction
>>>
>>> I've noticed that "pg8000_statement_0" is referenced at line 1894 in 
>>> gluon/contrib/pg8000/core.py, but I can't realise if there is something I 
>>> could do to avoid the error. 
>>> I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25, 
>>> and I've noticed that gluon/contrib/pg8000/core.py isn't anymore in version 
>>> 2.17.1.
>>>
>>> Of course I've tried restarting al the involved services, but nothing 
>>> worked. Every time my web2py application tries to connect to the database, 
>>> if pgBouncer is at the middle, the 5 attempts fail and those lines are 
>>> printed to the postgresql.log. Right now I've bypassed pgbouncer and my 
>>> application is connecting directly to postgresql.
>>>
>>> Could you put some lights into this? What can I do to avoid that error 
>>> and still connect to pgBouncer with web2py 2.16.1?
>>>
>>> Thank you very much in advance.
>>> Regards, Lisandro.
>>>
>>> -- 
>>> 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.
>>>
>>
>>
>> -- 
>> Massimiliano
>>
>

-- 
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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Lisandro
Thanks Massimiliano.

Apparently psycopg2 is already installed (of course it was already 
installed, maybe something broke during the packages upgrade).
Something weird is that I see psycopg2 installed twice, is this correct?

~$ pip freeze | grep psycopg2
psycopg2==2.7.5
psycopg2-binary==2.7.5

Could this be the source of the problem?
I don't see how. For what I understand, using or not using pgBouncer in the 
middle is transparent to the web2py application: it always connects in the 
same way, the application doesn't know if its connecting to PostgreSQL or 
pgBouncer. I think that's the whole idea of pgBouncer, to act as a middle 
man, pooling connections, behaving as if the application was connected 
directly to PostgreSQL.

Any comment or suggestion will be much appreciated.

El miércoles, 23 de enero de 2019, 6:51:06 (UTC-3), Massimiliano escribió:
>
> Have you tried to install psycopg2? Is the standard de facto postgresql 
> driver.
> The pip package should be psycopg2-binary
>
> On Wed, Jan 23, 2019 at 10:39 AM Lisandro  > wrote:
>
>> Hi there! Yesterday I had a MAJOR downtime and I would need your help to 
>> understand what happened.
>>
>> The team that is in charge of upgrading security packages at my server 
>> (CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer. 
>> Accordingly to what they said, they noticed pgBouncer was throwing errors 
>> after the upgrade, so they downgraded to the previous version that was 
>> installed. But sadly the problem remained. After this upgrade/downgrade of 
>> pgBouncer, all the attempts of connecting from my web2py app to pgBouncer 
>> fail. 
>>
>> Inside of postgresql.log I can see lot of this:
>> 2019-01-22 14:39:37 -03 ERROR:  prepared statement «pg8000_statement_0» 
>> already exists
>> 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
>> 2019-01-22 14:39:38 -03 ERROR:  prepared statement «pg8000_statement_0» 
>> already exists
>> 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction
>>
>> I've noticed that "pg8000_statement_0" is referenced at line 1894 in 
>> gluon/contrib/pg8000/core.py, but I can't realise if there is something I 
>> could do to avoid the error. 
>> I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25, and 
>> I've noticed that gluon/contrib/pg8000/core.py isn't anymore in version 
>> 2.17.1.
>>
>> Of course I've tried restarting al the involved services, but nothing 
>> worked. Every time my web2py application tries to connect to the database, 
>> if pgBouncer is at the middle, the 5 attempts fail and those lines are 
>> printed to the postgresql.log. Right now I've bypassed pgbouncer and my 
>> application is connecting directly to postgresql.
>>
>> Could you put some lights into this? What can I do to avoid that error 
>> and still connect to pgBouncer with web2py 2.16.1?
>>
>> Thank you very much in advance.
>> Regards, Lisandro.
>>
>> -- 
>> 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.
>>
>
>
> -- 
> Massimiliano
>

-- 
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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Massimiliano
Have you tried to install psycopg2? Is the standard de facto postgresql
driver.
The pip package should be psycopg2-binary

On Wed, Jan 23, 2019 at 10:39 AM Lisandro 
wrote:

> Hi there! Yesterday I had a MAJOR downtime and I would need your help to
> understand what happened.
>
> The team that is in charge of upgrading security packages at my server
> (CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer.
> Accordingly to what they said, they noticed pgBouncer was throwing errors
> after the upgrade, so they downgraded to the previous version that was
> installed. But sadly the problem remained. After this upgrade/downgrade of
> pgBouncer, all the attempts of connecting from my web2py app to pgBouncer
> fail.
>
> Inside of postgresql.log I can see lot of this:
> 2019-01-22 14:39:37 -03 ERROR:  prepared statement «pg8000_statement_0»
> already exists
> 2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
> 2019-01-22 14:39:38 -03 ERROR:  prepared statement «pg8000_statement_0»
> already exists
> 2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction
>
> I've noticed that "pg8000_statement_0" is referenced at line 1894 in
> gluon/contrib/pg8000/core.py, but I can't realise if there is something I
> could do to avoid the error.
> I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25, and
> I've noticed that gluon/contrib/pg8000/core.py isn't anymore in version
> 2.17.1.
>
> Of course I've tried restarting al the involved services, but nothing
> worked. Every time my web2py application tries to connect to the database,
> if pgBouncer is at the middle, the 5 attempts fail and those lines are
> printed to the postgresql.log. Right now I've bypassed pgbouncer and my
> application is connecting directly to postgresql.
>
> Could you put some lights into this? What can I do to avoid that error and
> still connect to pgBouncer with web2py 2.16.1?
>
> Thank you very much in advance.
> Regards, Lisandro.
>
> --
> 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.
>


-- 
Massimiliano

-- 
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: prepared statement «pg8000_statement_0» already exists

2019-01-23 Thread Lisandro
Hi there! Yesterday I had a MAJOR downtime and I would need your help to 
understand what happened.

The team that is in charge of upgrading security packages at my server 
(CentOS 7 at Linode) did an update that involved an upgrade to pgBouncer. 
Accordingly to what they said, they noticed pgBouncer was throwing errors 
after the upgrade, so they downgraded to the previous version that was 
installed. But sadly the problem remained. After this upgrade/downgrade of 
pgBouncer, all the attempts of connecting from my web2py app to pgBouncer 
fail. 

Inside of postgresql.log I can see lot of this:
2019-01-22 14:39:37 -03 ERROR:  prepared statement «pg8000_statement_0» 
already exists
2019-01-22 14:39:37 -03 SENTENCIA:  begin transaction
2019-01-22 14:39:38 -03 ERROR:  prepared statement «pg8000_statement_0» 
already exists
2019-01-22 14:39:38 -03 SENTENCIA:  begin transaction

I've noticed that "pg8000_statement_0" is referenced at line 1894 in 
gluon/contrib/pg8000/core.py, but I can't realise if there is something I 
could do to avoid the error. 
I'm using web2py Version 2.16.1-stable+timestamp.2017.11.14.05.54.25, and 
I've noticed that gluon/contrib/pg8000/core.py isn't anymore in version 
2.17.1.

Of course I've tried restarting al the involved services, but nothing 
worked. Every time my web2py application tries to connect to the database, 
if pgBouncer is at the middle, the 5 attempts fail and those lines are 
printed to the postgresql.log. Right now I've bypassed pgbouncer and my 
application is connecting directly to postgresql.

Could you put some lights into this? What can I do to avoid that error and 
still connect to pgBouncer with web2py 2.16.1?

Thank you very much in advance.
Regards, Lisandro.

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