[SQL-CVS] SQLObject development repository branch master updated. 3.1.0-50-g88f667c
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <no...@so...> - 2016-11-15 19:26:20
|
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 88f667cd6018b937beb21402b661e068f02f595c (commit) via 9a6e7646290decbb44a5759a2383765d46e14eb2 (commit) via a97208cd54a168d5e41f155c3a44eb17dc9a4471 (commit) via 512aa49fd39427157dbbfc724cc065bd405eba9b (commit) from 0ff72eaf5a436ba92bd037cd8f53d9acf241a7aa (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/88f667cd6018b937beb21402b661e068f02f595c commit 88f667cd6018b937beb21402b661e068f02f595c Author: Oleg Broytman <ph...@ph...> Date: Tue Nov 15 21:17:32 2016 +0300 Ignore flake8 E305 error E305: expected 2 blank lines after class or function definition, found 1. We often group related statements separated with only one blank line. diff --git a/setup.cfg b/setup.cfg index de55225..4c5fd41 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,6 +5,8 @@ tag_svn_revision = 0 [flake8] exclude = .git,.tox,docs/europython/*.py,ez_setup.py +# E305: expected 2 blank lines after class or function definition, found 1 +ignore = E305 [bdist_wheel] universal = 1 http://sourceforge.net/p/sqlobject/sqlobject/ci/9a6e7646290decbb44a5759a2383765d46e14eb2 commit 9a6e7646290decbb44a5759a2383765d46e14eb2 Author: Oleg Broytman <ph...@ph...> Date: Tue Nov 15 20:40:31 2016 +0300 Add ``driver`` keyword for MySQLConnection Allowed value is 'mysqldb'. diff --git a/docs/News.rst b/docs/News.rst index 8f2bc98..ac9c288 100644 --- a/docs/News.rst +++ b/docs/News.rst @@ -23,6 +23,8 @@ Minor features * Add ``driver`` keyword for FirebirdConnection. Allowed values are 'fdb' or 'kinterbasdb'. Default is to test 'fdb' and 'kinterbasdb' in that order. +* Add ``driver`` keyword for MySQLConnection. Allowed value is 'mysqldb'. + Documentation ------------- diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py index ccc4908..3372ef1 100644 --- a/sqlobject/mysql/mysqlconnection.py +++ b/sqlobject/mysql/mysqlconnection.py @@ -21,8 +21,28 @@ class MySQLConnection(DBAPI): schemes = [dbName] def __init__(self, db, user, password='', host='localhost', port=0, **kw): - import MySQLdb, MySQLdb.constants.CR, MySQLdb.constants.ER # noqa - self.module = MySQLdb + drivers = kw.pop('driver', None) or 'mysqldb' + for driver in drivers.split(','): + driver = driver.strip() + if not driver: + continue + try: + if driver.lower() == 'mysqldb': + import MySQLdb + import MySQLdb.constants.CR + import MySQLdb.constants.ER + self.module = MySQLdb + else: + raise ValueError( + 'Unknown MySQL driver "%s", ' + 'expected mysqldb' % driver) + except ImportError: + pass + else: + break + else: + raise ImportError( + 'Cannot find a MySQL driver, tried %s' % drivers) self.host = host self.port = port self.db = db http://sourceforge.net/p/sqlobject/sqlobject/ci/a97208cd54a168d5e41f155c3a44eb17dc9a4471 commit a97208cd54a168d5e41f155c3a44eb17dc9a4471 Author: Oleg Broytman <ph...@ph...> Date: Tue Nov 15 20:25:42 2016 +0300 Add ``driver`` keyword for FirebirdConnection Allowed values are 'fdb' or 'kinterbasdb'. Default is to test 'fdb' and 'kinterbasdb' in that order. [skip ci] we do not have tests for Firebird. diff --git a/docs/News.rst b/docs/News.rst index 06e61a8..8f2bc98 100644 --- a/docs/News.rst +++ b/docs/News.rst @@ -20,6 +20,9 @@ Minor features * Remove ``driver`` keyword from RdbhostConnection as it allows one driver ``rdbhost``. +* Add ``driver`` keyword for FirebirdConnection. Allowed values are 'fdb' or + 'kinterbasdb'. Default is to test 'fdb' and 'kinterbasdb' in that order. + Documentation ------------- diff --git a/sqlobject/firebird/firebirdconnection.py b/sqlobject/firebird/firebirdconnection.py index 2118bb4..cf4aed3 100644 --- a/sqlobject/firebird/firebirdconnection.py +++ b/sqlobject/firebird/firebirdconnection.py @@ -16,17 +16,34 @@ class FirebirdConnection(DBAPI): def __init__(self, host, db, port='3050', user='sysdba', password='masterkey', autoCommit=1, dialect=None, role=None, charset=None, **kw): - try: - import fdb - self.module = fdb - except ImportError: - import kinterbasdb - # See http://kinterbasdb.sourceforge.net/dist_docs/usage.html - # for an explanation; in short: use datetime, decimal and - # unicode. - kinterbasdb.init(type_conv=200) - self.module = kinterbasdb - + drivers = kw.pop('driver', None) or 'fdb,kinterbasdb' + for driver in drivers.split(','): + driver = driver.strip() + if not driver: + continue + try: + if driver == 'fdb': + import fdb + self.module = fdb + elif driver == 'kinterbasdb': + import kinterbasdb + # See + # http://kinterbasdb.sourceforge.net/dist_docs/usage.html + # for an explanation; in short: use datetime, decimal and + # unicode. + kinterbasdb.init(type_conv=200) + self.module = kinterbasdb + else: + raise ValueError( + 'Unknown FireBird driver "%s", ' + 'expected fdb or kinterbasdb' % driver) + except ImportError: + pass + else: + break + else: + raise ImportError( + 'Cannot find an FireBird driver, tried %s' % drivers) self.host = host self.port = port self.db = db http://sourceforge.net/p/sqlobject/sqlobject/ci/512aa49fd39427157dbbfc724cc065bd405eba9b commit 512aa49fd39427157dbbfc724cc065bd405eba9b Author: Oleg Broytman <ph...@ph...> Date: Tue Nov 15 20:11:55 2016 +0300 RdbhostConnection allows one driver ``rdbhost`` No need to pass ``driver`` keyword, no need to loop over a list of drivers of one driver. [skip ci] we do not have tests for rdbhost. diff --git a/docs/News.rst b/docs/News.rst index 7804d70..06e61a8 100644 --- a/docs/News.rst +++ b/docs/News.rst @@ -13,10 +13,13 @@ SQLObject 3.2.0 (master) Minor features -------------- -* Dropped table name from ``VACUUM`` command in SQLiteConnection: +* Drop table name from ``VACUUM`` command in SQLiteConnection: SQLite doesn't vacuum a single table and SQLite 3.15 uses the supplied name as the name of the attached database to vacuum. +* Remove ``driver`` keyword from RdbhostConnection as it allows one driver + ``rdbhost``. + Documentation ------------- diff --git a/sqlobject/rdbhost/rdbhostconnection.py b/sqlobject/rdbhost/rdbhostconnection.py index 1e67fa3..25200e9 100644 --- a/sqlobject/rdbhost/rdbhostconnection.py +++ b/sqlobject/rdbhost/rdbhostconnection.py @@ -15,34 +15,19 @@ class RdbhostConnection(PostgresConnection): schemes = [dbName] def __init__(self, dsn=None, host=None, port=None, db=None, - user=None, password=None, unicodeCols=False, driver='rdbhost', - **kw): - drivers = driver - for driver in drivers.split(','): - driver = driver.strip() - if not driver: - continue - try: - if driver == 'rdbhost': - from rdbhdb import rdbhdb as rdb - # monkey patch % escaping into Cursor._execute - old_execute = getattr(rdb.Cursor, '_execute') - setattr(rdb.Cursor, '_old_execute', old_execute) + user=None, password=None, unicodeCols=False, **kw): + from rdbhdb import rdbhdb as rdb + # monkey patch % escaping into Cursor._execute + old_execute = getattr(rdb.Cursor, '_execute') + setattr(rdb.Cursor, '_old_execute', old_execute) - def _execute(self, query, *args): - assert not any([a for a in args]) - query = query.replace('%', '%%') - self._old_execute(query, (), (), ()) - setattr(rdb.Cursor, '_execute', _execute) - self.module = rdb - else: - raise ValueError('Unknown Rdbhost driver %s' % driver) - except ImportError: - pass - else: - break - else: - raise ImportError('Cannot find the Rdbhost driver') + def _execute(self, query, *args): + assert not any([a for a in args]) + query = query.replace('%', '%%') + self._old_execute(query, (), (), ()) + setattr(rdb.Cursor, '_execute', _execute) + + self.module = rdb self.user = user self.host = host self.port = port ----------------------------------------------------------------------- Summary of changes: docs/News.rst | 10 +++++++- setup.cfg | 2 + sqlobject/firebird/firebirdconnection.py | 39 +++++++++++++++++++++-------- sqlobject/mysql/mysqlconnection.py | 24 +++++++++++++++++- sqlobject/rdbhost/rdbhostconnection.py | 39 +++++++++-------------------- 5 files changed, 73 insertions(+), 41 deletions(-) hooks/post-receive -- SQLObject development repository |