diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-05-30 12:00:05 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-05-30 12:00:05 -0400 |
commit | 49c667e27dc6d09204c2bc18d77a5dc86bb20f53 (patch) | |
tree | 2f588f784ddd916492e4f467b2139a69bc83a0a7 /lib/sqlalchemy/dialects/postgresql | |
parent | 860b413ade325a490557e11e09ccdab6d83fb823 (diff) | |
download | sqlalchemy-49c667e27dc6d09204c2bc18d77a5dc86bb20f53.tar.gz |
update comments
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/psycopg2.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index b79dfdb2a..6867650c5 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -489,22 +489,24 @@ class PGDialect_psycopg2(PGDialect): def is_disconnect(self, e, connection, cursor): if isinstance(e, self.dbapi.Error): - # Is the connection already marked as closed? + # check the "closed" flag. this might not be + # present on old psycopg2 versions if getattr(connection, 'closed', False): return True + # legacy checks based on strings. the "closed" check + # above most likely obviates the need for any of these. str_e = str(e).partition("\n")[0] for msg in [ # these error messages from libpq: interfaces/libpq/fe-misc.c # and interfaces/libpq/fe-secure.c. - # TODO: these are sent through gettext in libpq and we can't - # check within other locales 'terminating connection', 'closed the connection', 'connection not open', 'could not receive data from server', 'could not send data to server', - # psycopg2 client errors, psycopg2/conenction.h, psycopg2/cursor.h + # psycopg2 client errors, psycopg2/conenction.h, + # psycopg2/cursor.h 'connection already closed', 'cursor already closed', # not sure where this path is originally from, it may |