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
via 8223b12914d5c0bfb07443d5f3eb3d510b83907b (commit)
via b67997680ae501265eefed9adad4f717244504d6 (commit)
via dd146e84628fa81829c28962e62711f919aad397 (commit)
via 63d714af46b803d595b3b6573e7df2a27d3a9a5a (commit)
via 84201d592fd3dc6b05f606fa49361b63c7b98851 (commit)
via 0abfcb87f62261f850943ad894b6f01b34c889e1 (commit)
from 3656877ae44c7b48b98baf0c7c9b9ae0f5ce924c (commit)
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/8223b12914d5c0bfb07443d5f3eb3d510b83907b
commit 8223b12914d5c0bfb07443d5f3eb3d510b83907b
Author: Oleg Broytman <ph...@ph...>
Date: Tue Mar 3 21:41:56 2015 +0300
SQLObject now uses https://github.com/PyMySQL/mysqlclient-python
diff --git a/docs/TODO.txt b/docs/TODO.txt
index 3556b68..b4f4f16 100644
--- a/docs/TODO.txt
+++ b/docs/TODO.txt
@@ -74,8 +74,6 @@ TODO
* Pure Python Mysql Interface: https://github.com/nasi/MyPy
-* PyMySQL: https://github.com/PyMySQL/PyMySQL
-
* pg8000 driver: http://code.google.com/p/pg8000/
* py-postgresql driver: http://python.projects.postgresql.org/
http://sourceforge.net/p/sqlobject/sqlobject/ci/b67997680ae501265eefed9adad4f717244504d6
commit b67997680ae501265eefed9adad4f717244504d6
Merge: 3656877 dd146e8
Author: Oleg Broytman <ph...@ph...>
Date: Tue Mar 3 21:40:51 2015 +0300
Merge pull request #104 from drnlm/mysql_py3
Mysql support for python 3
http://sourceforge.net/p/sqlobject/sqlobject/ci/dd146e84628fa81829c28962e62711f919aad397
commit dd146e84628fa81829c28962e62711f919aad397
Author: Neil <drn...@gm...>
Date: Tue Mar 3 12:25:07 2015 +0200
Test using mysqlclient on python 3
diff --git a/.travis.yml b/.travis.yml
index e78ad92..92ecc8f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,7 @@ env:
- TOXENV=py27-sqlite
- TOXENV=py34-sqlite
- TOXENV=py34-postgres
+ - TOXENV=py34-mysqlclient
- TOXENV=py27-flake8
- TOXENV=py34-flake8
@@ -19,6 +20,7 @@ matrix:
allow_failures:
- env: TOXENV=py34-sqlite
- env: TOXENV=py34-postgres
+ - env: TOXENV=py34-mysqlclient
- env: TOXENV=py34-flake8
script: tox -e ${TOXENV}
diff --git a/tox.ini b/tox.ini
index b91a30f..a949dff 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 1.8
-envlist = {py26,py27}-mysql,{py26,py27,py34}-postgres,{py26,py27,py34}-sqlite,{py27,py34}-flake8
+envlist = {py26,py27}-mysql,{py26,py27,py34}-postgres,{py26,py27,py34}-sqlite,{py27,py34}-flake8,py34-mysqlclient
# Base test environment settings
[testenv]
@@ -19,6 +19,7 @@ deps =
FormEncode >= 1.1.1
PyDispatcher>=2.0.4
mysql: mysql-python
+ mysqlclient: mysqlclient
postgres: psycopg2
@@ -67,6 +68,12 @@ commands =
py.test -D postgres://postgres:@localhost/sqlobject_test
psql -c 'drop database sqlobject_test;' -U postgres
+[testenv:py34-mysqlclient]
+commands =
+ mysql -e 'create database sqlobject_test;'
+ py.test -D mysql://root:@localhost/sqlobject_test
+ mysql -e 'drop database sqlobject_test;'
+
[testenv:py27-flake8]
basepython = python2.7
deps =
http://sourceforge.net/p/sqlobject/sqlobject/ci/63d714af46b803d595b3b6573e7df2a27d3a9a5a
commit 63d714af46b803d595b3b6573e7df2a27d3a9a5a
Author: Neil <drn...@gm...>
Date: Tue Mar 3 12:16:05 2015 +0200
Ensure we encode bytes as required by mysqlclient on python 3
diff --git a/sqlobject/col.py b/sqlobject/col.py
index f0365e7..fe4eef1 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -560,6 +560,7 @@ class StringValidator(SOValidator):
try:
connection = state.connection or state.soObject._connection
binaryType = connection._binaryType
+ dbName = connection.dbName
except AttributeError:
binaryType = type(None) # Just a simple workaround
dbEncoding = self.getDbEncoding(state, default='ascii')
@@ -575,6 +576,9 @@ class StringValidator(SOValidator):
return value
if hasattr(value, '__unicode__'):
return unicode(value).encode(dbEncoding)
+ if dbName == 'mysql' and sys.version_info[0] > 2 and \
+ isinstance(value, bytes):
+ return value.decode('ascii', errors='surrogateescape')
raise validators.Invalid(
"expected a str in the StringCol '%s', got %s %r instead" % (
self.name, type(value), value), value, state)
@@ -1674,6 +1678,8 @@ class BinaryValidator(SOValidator):
if sys.version_info[0] > 2:
value = bytes(value, 'ascii')
value = connection.module.decode(value)
+ if dbName == "mysql" and sys.version_info[0] > 2:
+ value = value.encode('ascii', errors='surrogateescape')
return value
if isinstance(value, (buffer_type, binaryType)):
cachedValue = self._cachedValue
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index ffe91b5..0701367 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -1,3 +1,4 @@
+import sys
from sqlobject import col
from sqlobject import dberrors
from sqlobject.dbconnection import DBAPI
@@ -11,6 +12,8 @@ class ErrorMessage(str):
obj.exception = e.__class__.__name__
return obj
+mysql_Bin = None
+
class MySQLConnection(DBAPI):
@@ -45,6 +48,12 @@ class MySQLConnection(DBAPI):
else:
self.dbEncoding = None
+ global mysql_Bin
+ if sys.version_info[0] > 2 and mysql_Bin is None:
+ mysql_Bin = MySQLdb.Binary
+ MySQLdb.Binary = lambda x: mysql_Bin(x).decode(
+ 'ascii', errors='surrogateescape')
+
# MySQLdb < 1.2.1: only ascii
# MySQLdb = 1.2.1: only unicode
# MySQLdb > 1.2.1: both ascii and unicode
http://sourceforge.net/p/sqlobject/sqlobject/ci/84201d592fd3dc6b05f606fa49361b63c7b98851
commit 84201d592fd3dc6b05f606fa49361b63c7b98851
Author: Neil <drn...@gm...>
Date: Tue Mar 3 11:24:37 2015 +0200
Update exception syntax
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index c61a38e..ffe91b5 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -5,8 +5,8 @@ from sqlobject.dbconnection import DBAPI
class ErrorMessage(str):
def __new__(cls, e, append_msg=''):
- obj = str.__new__(cls, e[1] + append_msg)
- obj.code = int(e[0])
+ obj = str.__new__(cls, e.args[1] + append_msg)
+ obj.code = int(e.args[0])
obj.module = e.__module__
obj.exception = e.__class__.__name__
return obj
@@ -207,7 +207,7 @@ class MySQLConnection(DBAPI):
self.query('DESCRIBE %s' % (tableName))
return True
except dberrors.ProgrammingError as e:
- if e[0].code == 1146: # ER_NO_SUCH_TABLE
+ if e.args[0].code == 1146: # ER_NO_SUCH_TABLE
return False
raise
http://sourceforge.net/p/sqlobject/sqlobject/ci/0abfcb87f62261f850943ad894b6f01b34c889e1
commit 0abfcb87f62261f850943ad894b6f01b34c889e1
Author: Neil <drn...@gm...>
Date: Tue Mar 3 11:24:14 2015 +0200
Protect against comparison to none
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 28e5693..f0365e7 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -1714,12 +1714,13 @@ class SOBLOBCol(SOStringCol):
def _mysqlType(self):
length = self.length
varchar = self.varchar
- if length >= 2 ** 24:
- return varchar and "LONGTEXT" or "LONGBLOB"
- if length >= 2 ** 16:
- return varchar and "MEDIUMTEXT" or "MEDIUMBLOB"
- if length >= 2 ** 8:
- return varchar and "TEXT" or "BLOB"
+ if length:
+ if length >= 2 ** 24:
+ return varchar and "LONGTEXT" or "LONGBLOB"
+ if length >= 2 ** 16:
+ return varchar and "MEDIUMTEXT" or "MEDIUMBLOB"
+ if length >= 2 ** 8:
+ return varchar and "TEXT" or "BLOB"
return varchar and "TINYTEXT" or "TINYBLOB"
def _postgresType(self):
@@ -1778,10 +1779,11 @@ class SOPickleCol(SOBLOBCol):
def _mysqlType(self):
length = self.length
- if length >= 2 ** 24:
- return "LONGBLOB"
- if length >= 2 ** 16:
- return "MEDIUMBLOB"
+ if length:
+ if length >= 2 ** 24:
+ return "LONGBLOB"
+ if length >= 2 ** 16:
+ return "MEDIUMBLOB"
return "BLOB"
-----------------------------------------------------------------------
Summary of changes:
.travis.yml | 2 ++
docs/TODO.txt | 2 --
sqlobject/col.py | 28 ++++++++++++++++++----------
sqlobject/mysql/mysqlconnection.py | 15 ++++++++++++---
tox.ini | 9 ++++++++-
5 files changed, 40 insertions(+), 16 deletions(-)
hooks/post-receive
--
SQLObject development repository
|