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 1c246013fbaeca294889747f26e373108e45a23e (commit)
via f0b0085ef16194976fbf5d70f93dfeee6263283c (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 (1c246013fbaeca294889747f26e373108e45a23e)
\
N -- N -- N (f0b0085ef16194976fbf5d70f93dfeee6263283c)
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/f0b0085ef16194976fbf5d70f93dfeee6263283c
commit f0b0085ef16194976fbf5d70f93dfeee6263283c
Author: Oleg Broytman <ph...@ph...>
Date: Fri Nov 18 20:27:12 2016 +0300
Add support for PyMySQL
diff --git a/.travis.yml b/.travis.yml
index 1e314c2..8ab8400 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,6 +23,12 @@ env:
- TOXENV=py27-mysql-connector
- TOXENV=py34-mysql-connector
- TOXENV=py35-mysql-connector
+ - TOXENV=py26-oursql
+ - TOXENV=py27-oursql
+ - TOXENV=py26-pymysql
+ - TOXENV=py27-pymysql
+ - TOXENV=py34-pymysql
+ - TOXENV=py35-pymysql
- TOXENV=py26-postgres
- TOXENV=py27-postgres
- TOXENV=py34-postgres
@@ -31,8 +37,6 @@ env:
- TOXENV=py27-sqlite
- TOXENV=py34-sqlite
- TOXENV=py35-sqlite
- - TOXENV=py26-oursql
- - TOXENV=py27-oursql
- TOXENV=py27-flake8
- TOXENV=py34-flake8
@@ -46,6 +50,10 @@ matrix:
- env: TOXENV=py35-mysql-connector
- env: TOXENV=py26-oursql
- env: TOXENV=py27-oursql
+ - env: TOXENV=py26-pymysql
+ - env: TOXENV=py27-pymysql
+ - env: TOXENV=py34-pymysql
+ - env: TOXENV=py35-pymysql
fast_finish: true
script: tox -e ${TOXENV}
diff --git a/docs/News.rst b/docs/News.rst
index 4f4514e..7c5ab0e 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -25,8 +25,8 @@ Minor features
order.
* Add ``driver`` keyword for MySQLConnection. Allowed value are 'mysqldb',
- 'connector' and 'oursql'. Default is to test for mysqldb only;
- (connector and oursql drivers still cause problems).
+ 'connector', 'oursql' and 'pymysql'. Default is to test for mysqldb only;
+ (connector, oursql and pymysql drivers still cause problems).
Work in progress
----------------
@@ -38,8 +38,12 @@ Work in progress
there are still problems).
* Add support for `oursql <https://github.com/python-oursql/oursql>`_ MySQL
- driver (Python 2.6 and 2.7 until oursql fixes python 3 compatibility; most
- tests are passed, but there are still problems).
+ driver (Python 2.6 and 2.7 until oursql fixes python 3 compatibility;
+ most tests are passed, but there are still problems).
+
+* Add support for `PyMySQL <https://github.com/PyMySQL/PyMySQL/>`_ - pure
+ python mysql interface; most tests are passed, but there are still
+ problems).
Documentation
-------------
diff --git a/docs/SQLObject.rst b/docs/SQLObject.rst
index 8680097..d86305c 100644
--- a/docs/SQLObject.rst
+++ b/docs/SQLObject.rst
@@ -47,7 +47,7 @@ Requirements
============
Currently SQLObject supports MySQL_ via MySQLdb_ aka MySQL-python (called
-mysqlclient_ for Python 3) or `MySQL Connector`_ or oursql_, PostgreSQL_
+mysqlclient_ for Python 3) or `MySQL Connector`_ or oursql_ or PyMySQL_, PostgreSQL_
via psycopg2_ or psycopg1, SQLite_ via PySQLite_, Firebird_ via fdb_ or
kinterbasdb_, `MAX DB`_ (also known as SAP DB) via sapdb_, Sybase via
Sybase_, and `MSSQL Server`_ via pymssql_ (+ FreeTDS_) or adodbapi_
@@ -58,6 +58,7 @@ Sybase_, and `MSSQL Server`_ via pymssql_ (+ FreeTDS_) or adodbapi_
.. _mysqlclient: https://pypi.python.org/pypi/mysqlclient
.. _`MySQL Connector`: https://pypi.python.org/pypi/mysql-connector
.. _oursql: https://github.com/python-oursql/oursql
+.. _PyMySQL: https://github.com/PyMySQL/PyMySQL/
.. _PostgreSQL: https://postgresql.org
.. _psycopg2: http://initd.org/psycopg/
.. _SQLite: https://sqlite.org/
diff --git a/docs/TODO.rst b/docs/TODO.rst
index 3fcfe50..54dc4ad 100644
--- a/docs/TODO.rst
+++ b/docs/TODO.rst
@@ -68,8 +68,6 @@ TODO
* Switch from setuptools to distribute.
-* Yet another pure python mysql interface: https://github.com/PyMySQL/PyMySQL/
-
* Ultramysql `for Python2 <https://github.com/esnme/ultramysql>`_ and
`Python3 <https://github.com/arpitbbhayani/umysql3>`_. See also `umysqldb
<https://github.com/hongqn/umysqldb>`_.
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index cddf52e..afb7e4d 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -81,7 +81,7 @@ def StringLikeConverter(value, db):
value = value.tounicode()
except ValueError:
value = value.tostring()
- elif isinstance(value, buffer_type):
+ elif isinstance(value, (bytearray, buffer_type)):
value = str(value)
if db in ('mysql', 'postgres', 'rdbhost'):
@@ -101,6 +101,7 @@ if PY2:
registerConverter(unicode, StringLikeConverter) # noqa
registerConverter(array, StringLikeConverter)
if PY2:
+ registerConverter(bytearray, StringLikeConverter)
registerConverter(buffer_type, StringLikeConverter)
else:
registerConverter(memoryview, StringLikeConverter)
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index ea14bff..149cd4c 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -27,17 +27,28 @@ class MySQLConnection(DBAPI):
if not driver:
continue
try:
- if driver.lower() == 'mysqldb':
+ if driver.lower() in ('mysqldb', 'pymysql'):
+ if driver.lower() == 'pymysql':
+ import pymysql
+ pymysql.install_as_MySQLdb()
import MySQLdb
- if MySQLdb.version_info[:3] < (1, 2, 2):
- raise ValueError(
- 'SQLObject requires MySQLdb 1.2.2 or later')
+ if driver.lower() == 'mysqldb':
+ if MySQLdb.version_info[:3] < (1, 2, 2):
+ raise ValueError(
+ 'SQLObject requires MySQLdb 1.2.2 or later')
import MySQLdb.constants.CR
import MySQLdb.constants.ER
self.module = MySQLdb
- self.CR_SERVER_GONE_ERROR = \
- MySQLdb.constants.CR.SERVER_GONE_ERROR
- self.CR_SERVER_LOST = MySQLdb.constants.CR.SERVER_LOST
+ if driver.lower() == 'mysqldb':
+ self.CR_SERVER_GONE_ERROR = \
+ MySQLdb.constants.CR.SERVER_GONE_ERROR
+ self.CR_SERVER_LOST = \
+ MySQLdb.constants.CR.SERVER_LOST
+ else:
+ self.CR_SERVER_GONE_ERROR = \
+ MySQLdb.constants.CR.CR_SERVER_GONE_ERROR
+ self.CR_SERVER_LOST = \
+ MySQLdb.constants.CR.CR_SERVER_LOST
self.ER_DUP_ENTRY = MySQLdb.constants.ER.DUP_ENTRY
elif driver == 'connector':
import mysql.connector
@@ -57,7 +68,8 @@ class MySQLConnection(DBAPI):
else:
raise ValueError(
'Unknown MySQL driver "%s", '
- 'expected mysqldb, connector or oursql' % driver)
+ 'expected mysqldb, connector, '
+ 'oursql or pymysql' % driver)
except ImportError:
pass
else:
diff --git a/tox.ini b/tox.ini
index f2f08da..60cbcac 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 1.8
-envlist = {py26,py27}-{mysqldb,oursql},{py34,py35}-mysqlclient,{py26,py27,py34,py35}-{mysql-connector,postgres,sqlite},{py27,py34}-flake8
+envlist = {py26,py27}-{mysqldb,oursql},{py34,py35}-mysqlclient,{py26,py27,py34,py35}-{mysql-connector,pymysql,postgres,sqlite},{py27,py34}-flake8
# Base test environment settings
[testenv]
@@ -17,6 +17,7 @@ deps =
mysqlclient: mysqlclient
mysql-connector: mysql-connector
py26,py27: oursql
+ pymysql: pymysql
postgres: psycopg2
passenv = CI TRAVIS TRAVIS_*
# Don't fail or warn on uninstalled commands
@@ -50,6 +51,24 @@ commands = {[mysqlclient]commands}
[testenv:py35-mysqlclient]
commands = {[mysqlclient]commands}
+[mysql-connector]
+commands =
+ mysql -e 'create database sqlobject_test;'
+ pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=connector&charset=utf8
+ mysql -e 'drop database sqlobject_test;'
+
+[testenv:py26-mysql-connector]
+commands = {[mysql-connector]commands}
+
+[testenv:py27-mysql-connector]
+commands = {[mysql-connector]commands}
+
+[testenv:py34-mysql-connector]
+commands = {[mysql-connector]commands}
+
+[testenv:py35-mysql-connector]
+commands = {[mysql-connector]commands}
+
[oursql]
commands =
mysql -e 'create database sqlobject_test;'
@@ -62,23 +81,23 @@ commands = {[oursql]commands}
[testenv:py27-oursql]
commands = {[oursql]commands}
-[mysql-connector]
+[pymysql]
commands =
mysql -e 'create database sqlobject_test;'
- pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=connector&charset=utf8
+ pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=pymysql&charset=utf8
mysql -e 'drop database sqlobject_test;'
-[testenv:py26-mysql-connector]
-commands = {[mysql-connector]commands}
+[testenv:py26-pymysql]
+commands = {[pymysql]commands}
-[testenv:py27-mysql-connector]
-commands = {[mysql-connector]commands}
+[testenv:py27-pymysql]
+commands = {[pymysql]commands}
-[testenv:py34-mysql-connector]
-commands = {[mysql-connector]commands}
+[testenv:py34-pymysql]
+commands = {[pymysql]commands}
-[testenv:py35-mysql-connector]
-commands = {[mysql-connector]commands}
+[testenv:py35-pymysql]
+commands = {[pymysql]commands}
# PostgreSQL test environments
[postgresql]
-----------------------------------------------------------------------
Summary of changes:
docs/SQLObject.rst | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
hooks/post-receive
--
SQLObject development repository
|