psycopg -> psycopg2 name change.

This commit is contained in:
Federico Di Gregorio 2005-08-22 01:49:18 +00:00
parent 3e3084e4c6
commit 4d536c1f12
5 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,10 @@
2005-08-22 Federico Di Gregorio <fog@debian.org>
* ZPsycopgDA/*.py: psycopg -> psycopg2.
* setup.py: modified to install the module components under
psycopg2 on windows too (thanks to Daniele Varrazzo.)
2005-08-07 Federico Di Gregorio <fog@debian.org>
* psycopg/config.h: added __sun__ to the symbols checked for round()

View File

@ -36,11 +36,11 @@ from DateTime import DateTime
# import psycopg and functions/singletons needed for date/time conversions
import psycopg
from psycopg import NUMBER, STRING, ROWID, DATETIME
from psycopg.extensions import INTEGER, LONGINTEGER, FLOAT, BOOLEAN, DATE
from psycopg.extensions import TIME, INTERVAL
from psycopg.extensions import new_type, register_type
import psycopg2
from psycopg2 import NUMBER, STRING, ROWID, DATETIME
from psycopg2.extensions import INTEGER, LONGINTEGER, FLOAT, BOOLEAN, DATE
from psycopg2.extensions import TIME, INTERVAL
from psycopg2.extensions import new_type, register_type
@ -112,9 +112,9 @@ class Connection(Shared.DC.ZRDB.Connection.Connection):
pass
# check psycopg version and raise exception if does not match
if psycopg.__version__[:5] not in ALLOWED_PSYCOPG_VERSIONS:
if psycopg2.__version__[:5] not in ALLOWED_PSYCOPG_VERSIONS:
raise ImportError("psycopg version mismatch (imported %s)" %
psycopg.__version__)
psycopg2.__version__)
self.set_type_casts()
self._v_connected = ''

View File

@ -25,9 +25,9 @@ from ZODB.POSException import ConflictError
import site
import pool
import psycopg
from psycopg.extensions import INTEGER, LONGINTEGER, FLOAT, BOOLEAN, DATE
from psycopg import NUMBER, STRING, ROWID, DATETIME
import psycopg2
from psycopg2.extensions import INTEGER, LONGINTEGER, FLOAT, BOOLEAN, DATE
from psycopg2 import NUMBER, STRING, ROWID, DATETIME
@ -186,18 +186,19 @@ class DB(TM, dbi_db.DB):
c.execute(qs, query_data)
else:
c.execute(qs)
except (psycopg.ProgrammingError,psycopg.IntegrityError),e:
except (psycopg2.ProgrammingError,
psycopg2.IntegrityError), e:
if e.args[0].find("concurrent update") > -1:
raise ConflictError
raise e
except (psycopg.ProgrammingError,psycopg.IntegrityError), e:
except (psycopg2.ProgrammingError, psycopg2.IntegrityError), e:
if e.args[0].find("concurrent update") > -1:
raise ConflictError
raise e
if c.description is not None:
nselects += 1
if c.description != desc and nselects > 1:
raise psycopg.ProgrammingError(
raise psycopg2.ProgrammingError(
'multiple selects in single query not allowed')
if max_rows:
res = c.fetchmany(max_rows)

View File

@ -21,7 +21,7 @@
# ZPsycopgDA code in db.py
import threading
import psycopg.pool
import psycopg2.pool
_connections_pool = {}
_connections_lock = threading.Lock()
@ -31,7 +31,7 @@ def getpool(dsn, create=True):
try:
if not _connections_pool.has_key(dsn) and create:
_connections_pool[dsn] = \
psycopg.pool.ThreadedConnectionPool(4, 200, dsn)
psycopg2.pool.ThreadedConnectionPool(4, 200, dsn)
finally:
_connections_lock.release()
return _connections_pool[dsn]

View File

@ -311,7 +311,7 @@ else:
if sys.platform == 'win32' and int(parser.get('build_ext', 'use_pg_dll')):
data_files.append((".\\lib\\site-packages\\psycopg\\",
data_files.append((".\\lib\\site-packages\\psycopg2\\",
[ "lib\\libpq.dll" ]))
# build the extension