This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
discards ade481a3f94438a26ba35dc8248a6d84eb38de65 (commit)
via 48ddb3a762f62b03843db11a9d3fc878ef2038fd (commit)
via 044e33067682d9fb96345fde28f2761a85005b14 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (ade481a3f94438a26ba35dc8248a6d84eb38de65)
\
N -- N -- N (48ddb3a762f62b03843db11a9d3fc878ef2038fd)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/48ddb3a762f62b03843db11a9d3fc878ef2038fd
commit 48ddb3a762f62b03843db11a9d3fc878ef2038fd
Author: Oleg Broytman <ph...@ph...>
Date: Wed Aug 2 01:32:11 2017 +0300
Tests: Fix a bug with sqlite-memory
Rollback transaction and close connection.
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 9fd03d3..f11cfef 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -22,7 +22,7 @@ I'm pleased to announce version 3.4.1, the first bugfix release of branch
What's new in SQLObject
=======================
-Contributor for this release is
+Contributor for this release is Dr. Neil Muller.
For a more complete list, please see the news:
http://sqlobject.org/News.html
diff --git a/docs/News.rst b/docs/News.rst
index 540b47d..16bc6e0 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -44,6 +44,9 @@ Drivers (work in progress)
Tests
-----
+* Fix a bug with sqlite-memory: rollback transaction and close connection.
+ The solution was found by Dr. Neil Muller.
+
* Use remove-old-files.py from ppu to cleanup pip cache
at Travis and AppVeyor.
diff --git a/sqlobject/tests/test_transactions.py b/sqlobject/tests/test_transactions.py
index 0fbac42..b52ad52 100644
--- a/sqlobject/tests/test_transactions.py
+++ b/sqlobject/tests/test_transactions.py
@@ -50,7 +50,8 @@ def test_transaction():
def test_transaction_commit_sync():
setupClass(SOTestSOTrans)
- trans = SOTestSOTrans._connection.transaction()
+ connection = SOTestSOTrans._connection
+ trans = connection.transaction()
try:
SOTestSOTrans(name='bob')
bOut = SOTestSOTrans.byName('bob')
@@ -60,14 +61,16 @@ def test_transaction_commit_sync():
trans.commit()
assert bOut.name == 'robert'
finally:
- SOTestSOTrans._connection.autoCommit = True
+ trans.rollback()
+ connection.autoCommit = True
+ connection.close()
def test_transaction_delete(close=False):
setupClass(SOTestSOTrans)
connection = SOTestSOTrans._connection
if (connection.dbName == 'sqlite') and connection._memory:
- pytest.skip("The following test requires a different connection")
+ pytest.skip("The test doesn't work with sqlite memory connection")
trans = connection.transaction()
try:
SOTestSOTrans(name='bob')
http://sourceforge.net/p/sqlobject/sqlobject/ci/044e33067682d9fb96345fde28f2761a85005b14
commit 044e33067682d9fb96345fde28f2761a85005b14
Author: Oleg Broytman <ph...@ph...>
Date: Sun Jul 30 19:43:09 2017 +0300
Fix(pg): Encode binary values for PyGreSQL driver
Encode binary values for PyGreSQL driver using the same encoding as for
py-postgresql driver. This fixes the last remaining problems with the driver.
diff --git a/.travis.yml b/.travis.yml
index 79032aa..ddb1252 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -70,10 +70,6 @@ env:
matrix:
allow_failures:
- - env: TOXENV=py27-postgres-pygresql
- - env: TOXENV=py34-postgres-pygresql
- - env: TOXENV=py35-postgres-pygresql
- - env: TOXENV=py36-postgres-pygresql
- env: TOXENV=py27-firebird-fdb
- env: TOXENV=py34-firebird-fdb
- env: TOXENV=py35-firebird-fdb
diff --git a/docs/News.rst b/docs/News.rst
index e2a430c..540b47d 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -28,7 +28,16 @@ Drivers (work in progress)
* Encode binary values for py-postgresql driver. This fixes the
last remaining problems with the driver.
-* Encode/decode binary values for PyGreSQL driver.
+* Encode binary values for PyGreSQL driver using the same encoding as for
+ py-postgresql driver. This fixes the last remaining problems with the driver.
+
+ Our own encoding is needed because unescape_bytea(escape_bytea()) is not
+ idempotent. See the comment for PQunescapeBytea at
+ https://www.postgresql.org/docs/9.6/static/libpq-exec.html:
+
+ This conversion is not exactly the inverse of PQescapeBytea, because the
+ string is not expected to be "escaped" when received from PQgetvalue. In
+ particular this means there is no need for string quoting considerations.
* List all drivers in extras_require in setup.py.
diff --git a/docs/SQLObject.rst b/docs/SQLObject.rst
index e1f9b43..9a3121f 100644
--- a/docs/SQLObject.rst
+++ b/docs/SQLObject.rst
@@ -1831,9 +1831,9 @@ PostgresConnection supports transactions and all other features.
The user can choose a DB API driver for PostgreSQL by using a ``driver``
parameter in DB URI or PostgresConnection that can be a comma-separated
list of driver names. Possible drivers are: ``psycopg2``, psycopg1,
-``psycopg`` (tries psycopg2 and psycopg1), ``pygresql``, ``pygresql``,
-``pypostgresql``, ``pyodbc``, ``pypyodbc`` or ``odbc`` (try ``pyodbc`` and
-``pypyodbc``). Default is ``psycopg``.
+``psycopg`` (tries psycopg2 and psycopg1), ``pygresql``, ``pypostgresql``,
+``pyodbc``, ``pypyodbc`` or ``odbc`` (try ``pyodbc`` and ``pypyodbc``).
+Default is ``psycopg``.
Connection-specific parameters are: ``sslmode``, ``unicodeCols``,
``schema``, ``charset``.
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 6ee5e98..0f35862 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -1770,9 +1770,6 @@ class BinaryValidator(SOValidator):
if isinstance(value, str):
if not PY2 and dbName == "mysql":
value = value.encode('ascii', errors='surrogateescape')
- if dbName == "postgres" and connection.driver == 'pygresql':
- from pg import unescape_bytea
- value = unescape_bytea(value)
if dbName == "sqlite":
if not PY2:
value = bytes(value, 'ascii')
diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py
index 4e33185..494ff09 100644
--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -85,14 +85,9 @@ class PostgresConnection(DBAPI):
# Register a converter for psycopg Binary type.
registerConverter(type(self.module.Binary('')),
PsycoBinaryConverter)
- elif driver == 'pygresql':
- from pg import escape_bytea as pg_escape_bytea
- self.createBinary = \
- lambda value, pg_escape_bytea=pg_escape_bytea: \
- pg_escape_bytea(value)
- elif driver in ('py-postgresql', 'pypostgresql'):
+ elif driver in ('pygresql', 'py-postgresql', 'pypostgresql'):
registerConverter(type(self.module.Binary(b'')),
- PypostgresBinaryConverter)
+ PostgresBinaryConverter)
elif driver in ('odbc', 'pyodbc', 'pypyodbc'):
registerConverter(bytearray, OdbcBinaryConverter)
@@ -541,15 +536,23 @@ def PsycoBinaryConverter(value, db):
return str(value)
-def escape_bytea(value):
- return ''.join(
- ['\\' + (x[2:].rjust(3, '0')) for x in (oct(ord(c)) for c in value)]
- )
+if PY2:
+ def escape_bytea(value):
+ return ''.join(
+ ['\\' + (x[1:].rjust(3, '0'))
+ for x in (oct(ord(c)) for c in value)]
+ )
+else:
+ def escape_bytea(value):
+ return ''.join(
+ ['\\' + (x[2:].rjust(3, '0'))
+ for x in (oct(ord(c)) for c in value.decode('latin1'))]
+ )
-def PypostgresBinaryConverter(value, db):
+def PostgresBinaryConverter(value, db):
assert db == 'postgres'
- return sqlrepr(escape_bytea(value.decode('latin1')), db)
+ return sqlrepr(escape_bytea(value), db)
def OdbcBinaryConverter(value, db):
-----------------------------------------------------------------------
Summary of changes:
ANNOUNCE.rst | 2 +-
docs/News.rst | 9 ++++++---
sqlobject/tests/test_transactions.py | 9 ++++++---
3 files changed, 13 insertions(+), 7 deletions(-)
hooks/post-receive
--
SQLObject development repository
|