sqlobject-cvs Mailing List for SQLObject (Page 14)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Oleg B. <no...@so...> - 2015-03-09 20:39:27
|
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 d05edf6ecf34f6fc1ee855906e7ead37c9cbfbcb (commit) via 9110a3e51d42e0c524486c8af08e4b136eef8503 (commit) via 610ea28d7bf8d94a251bedeedd5c1b81322e4635 (commit) via abc2a884feb48c88fd4b13a0337ac75017bcb07d (commit) via 574622efb006d4b0aa0efb78590e915ac7dd429b (commit) via 196e1b05c2bb1c6541ebacd68ddde61ff9478626 (commit) via e5d2a0f8f1142d55a22b13ad34dadfdb8af23798 (commit) via b566e7d695c60cc90f507cb18009f4e120f907ca (commit) via 52c2cbee5d89a7f87a60f1d7876f75efdf5427bc (commit) via 1d9cac46a9500b96d2b51b201d68808af956ddc5 (commit) via ee1953be8a38d60de6b51873d851605f3cbfa00c (commit) from f8d9c4461436912ae7e9cfc8366537a93ffd8cb3 (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/d05edf6ecf34f6fc1ee855906e7ead37c9cbfbcb commit d05edf6ecf34f6fc1ee855906e7ead37c9cbfbcb Merge: 574622e 9110a3e Author: Oleg Broytman <ph...@ph...> Date: Mon Mar 9 23:35:13 2015 +0300 Merge branch '2.1' [skip ci] diff --cc docs/Authors.txt index 51f7035,19633cf..91b7301 --- a/docs/Authors.txt +++ b/docs/Authors.txt @@@ -30,7 -30,7 +30,8 @@@ Contributions have been made by * Andrew Ziem <ahz001 at gmail.com> * Andrew Trusty <atrusty at gatech.edu> * Ian Cordasco <graffatcolmingov at gmail.com> +* Lukasz Dobrzanski <lukasz.m.dobrzanski at gmail.com> + * Gregor Horvath <gh at gregor-horvath.com> * Oleg Broytman <ph...@ph...> .. image:: http://sflogo.sourceforge.net/sflogo.php?group_id=74338&type=10 http://sourceforge.net/p/sqlobject/sqlobject/ci/574622efb006d4b0aa0efb78590e915ac7dd429b commit 574622efb006d4b0aa0efb78590e915ac7dd429b Merge: f8d9c44 196e1b0 Author: Oleg Broytman <ph...@ph...> Date: Mon Mar 9 20:26:02 2015 +0300 Merge branch '2.1' diff --cc docs/News.txt index 36b488e,7a13743..9d4ea9b --- a/docs/News.txt +++ b/docs/News.txt @@@ -7,25 -7,11 +7,30 @@@ New .. _start: +SQLObject 3.0.0 (master) +======================== + +Minor features +-------------- + +* PyDispatcher (>=2.0.4) was made an external dependency. + +Development +----------- + +* Source code was made flake8-clean. + +Documentation +------------- + +* Documentation is published at http://sqlobject.readthedocs.org/ in + Sphinx format. + + SQLObject 2.1.1 + =============== + + * Minor fix in PostgresConnection was ported from `SQLObject 1.6.5`_. + SQLObject 2.1.0 =============== ----------------------------------------------------------------------- Summary of changes: docs/Authors.txt | 1 + docs/News.txt | 16 ++++++++++++++++ sqlobject/postgres/pgconnection.py | 10 ++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-09 20:39:19
|
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, 2.1 has been updated via 9110a3e51d42e0c524486c8af08e4b136eef8503 (commit) via 610ea28d7bf8d94a251bedeedd5c1b81322e4635 (commit) via abc2a884feb48c88fd4b13a0337ac75017bcb07d (commit) via 196e1b05c2bb1c6541ebacd68ddde61ff9478626 (commit) via e5d2a0f8f1142d55a22b13ad34dadfdb8af23798 (commit) via b566e7d695c60cc90f507cb18009f4e120f907ca (commit) via 52c2cbee5d89a7f87a60f1d7876f75efdf5427bc (commit) via 1d9cac46a9500b96d2b51b201d68808af956ddc5 (commit) via ee1953be8a38d60de6b51873d851605f3cbfa00c (commit) from d25d27fb9fa8a39a5ef11b7d7689ab14b90f0007 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: docs/Authors.txt | 1 + docs/News.txt | 16 ++++++++++++++++ sqlobject/postgres/pgconnection.py | 10 ++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-09 20:39:11
|
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, 1.7 has been updated via 610ea28d7bf8d94a251bedeedd5c1b81322e4635 (commit) via abc2a884feb48c88fd4b13a0337ac75017bcb07d (commit) via b566e7d695c60cc90f507cb18009f4e120f907ca (commit) via 52c2cbee5d89a7f87a60f1d7876f75efdf5427bc (commit) via 1d9cac46a9500b96d2b51b201d68808af956ddc5 (commit) via ee1953be8a38d60de6b51873d851605f3cbfa00c (commit) from ea339a430e7a405078e5d28b79bd3319adab9cea (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: docs/Authors.txt | 1 + docs/News.txt | 11 +++++++++++ sqlobject/postgres/pgconnection.py | 10 ++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-09 20:39:04
|
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, 1.6 has been updated via abc2a884feb48c88fd4b13a0337ac75017bcb07d (commit) via 1d9cac46a9500b96d2b51b201d68808af956ddc5 (commit) via ee1953be8a38d60de6b51873d851605f3cbfa00c (commit) from 2504ac83de701741a703b6adc3d55eda0a5a6524 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: docs/Authors.txt | 1 + docs/News.txt | 6 ++++++ sqlobject/postgres/pgconnection.py | 10 ++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-05 20:07:49
|
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 f8d9c4461436912ae7e9cfc8366537a93ffd8cb3 (commit) via 12f98ccbc4041f947dfa44a82de354914f78ba5e (commit) via 73513675144495b48a555a0a28f33fdc02eee044 (commit) via e9649a1889252e469a3032838c8653bf495f01f6 (commit) from 985b73167935bdd1c59f461079c6bb1642122d40 (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/f8d9c4461436912ae7e9cfc8366537a93ffd8cb3 commit f8d9c4461436912ae7e9cfc8366537a93ffd8cb3 Merge: 7351367 12f98cc Author: Oleg Broytman <ph...@ph...> Date: Thu Mar 5 23:06:55 2015 +0300 Merge pull request #110 from drnlm/require_mysqldb_1.2.2 Bump MySQLdb requirement to at least 1.2.2 http://sourceforge.net/p/sqlobject/sqlobject/ci/12f98ccbc4041f947dfa44a82de354914f78ba5e commit 12f98ccbc4041f947dfa44a82de354914f78ba5e Author: Neil <drn...@gm...> Date: Thu Mar 5 21:43:07 2015 +0200 Bump MySQLdb requirement to at least 1.2.2 diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py index 0701367..b346110 100644 --- a/sqlobject/mysql/mysqlconnection.py +++ b/sqlobject/mysql/mysqlconnection.py @@ -54,12 +54,8 @@ class MySQLConnection(DBAPI): 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 - self.need_unicode = ( - (self.module.version_info[:3] >= (1, 2, 1)) and - (self.module.version_info[:3] < (1, 2, 2))) + if self.module.version_info[:3] < (1, 2, 2): + raise ValueError('SQLObject requires MySQLdb 1.2.2 or later') self._server_version = None self._can_use_microseconds = None @@ -110,12 +106,6 @@ class MySQLConnection(DBAPI): conn.autocommit(auto) def _executeRetry(self, conn, cursor, query): - if self.need_unicode and not isinstance(query, unicode): - try: - query = unicode(query, self.dbEncoding) - except UnicodeError: - pass - # When a server connection is lost and a query is attempted, most of # the time the query will raise a SERVER_LOST exception, then at the # second attempt to execute it, the mysql lib will reconnect and http://sourceforge.net/p/sqlobject/sqlobject/ci/73513675144495b48a555a0a28f33fdc02eee044 commit 73513675144495b48a555a0a28f33fdc02eee044 Merge: 985b731 e9649a1 Author: Oleg Broytman <ph...@ph...> Date: Thu Mar 5 18:45:06 2015 +0300 Merge pull request #108 from drnlm/python3_doc Document SQLObject's behaviour with python 3 a bit http://sourceforge.net/p/sqlobject/sqlobject/ci/e9649a1889252e469a3032838c8653bf495f01f6 commit e9649a1889252e469a3032838c8653bf495f01f6 Author: Neil <drn...@gm...> Date: Thu Mar 5 11:47:27 2015 +0200 Document SQLObject's behaviour with python 3 a bit diff --git a/docs/Python3.txt b/docs/Python3.txt new file mode 100644 index 0000000..c099ec9 --- /dev/null +++ b/docs/Python3.txt @@ -0,0 +1,83 @@ +++++++++++++++++++++++ +SQLObject and Python 3 +++++++++++++++++++++++ + + +.. contents:: + + +Changes between Python 2 and Python 3 +------------------------------------- + +There are a few changes in the behaviour of SQLObject on Python 3, due to +the changed stings / bytes handling introduced in Python 3.0. + +BLOBCol +~~~~~~~ + +In Python 3, BLOBCol now accepts and returns bytes, rather than strings as it +did in Python 2. + +StringCol +~~~~~~~~~ + +In Python 3, StringCol now accepts arbitrary Unicode strings. + +UnicodeCol +~~~~~~~~~~ + +The dbEncoding parameter to UnicodeCol has no effect in Python 3 code. This +is now handled by the underlying database layer and is no longer exposed +via SQLObject. The parameter is still available for those writing Python 2 +compatible code. + + +Python 3 and MySQL +------------------ + +SQLObject is tested using mysqlclient_ as the database driver on Python 3. +Note that the default encoding of MySQL databases is *latin1*, which can cause +problems with general Unicode strings. We recommend specifying the character +set as *utf8* when using MySQL to protect against these issues. + +.. _mysqlclient: https://pypi.python.org/pypi/mysqlclient + + +Using databases created with SQLObject and Python 2 in Python 3 +--------------------------------------------------------------- + +For most cases, things should just work as before. The only issues should +around UnicodeCol, as how this is handled has changed. + +SQLite +~~~~~~ + +The Python 3 sqlite driver expects Unicode columns to be encoded using +utf8. Columns created using the default encoding on Python 2 should work fine, +but columns created with a different encoding set using the dbEncoding +parameter may cause problems. + +Postgres +~~~~~~~~ + +Postgres' behaviour is similar to sqlite. Columns created using the +default encoding on Python 2 should work fine, but columns created with a +different encoding set using the dbEncoding may cause problems. + +MySQL +~~~~~ + +For MySQL, the results depend on whether the Python 2 database was using +MySQLdb's Unicode mode or not. + +If a character set was specified for the database using the charset parameter, +such as:: + + mysql:///localhost/test?charset=latin1 + +Things should work provided the same character set is specified when using +Python 3. + +If a character set wasn't specified, then things may work if the character set +is set to match the dbEncoding parameter used when defining the UnicodeCol. + ----------------------------------------------------------------------- Summary of changes: docs/Python3.txt | 83 ++++++++++++++++++++++++++++++++++++ sqlobject/mysql/mysqlconnection.py | 14 +----- 2 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 docs/Python3.txt hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-04 23:29:36
|
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 985b73167935bdd1c59f461079c6bb1642122d40 (commit) via a05eb21b45515709f824f63a2f3db0d4286cb315 (commit) via 510e58c1313eb0fc660183bdf0256b8063959fa0 (commit) from 4ac1463aedf9e4fdb7a898d4b02c2f199148b70a (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/985b73167935bdd1c59f461079c6bb1642122d40 commit 985b73167935bdd1c59f461079c6bb1642122d40 Merge: 4ac1463 a05eb21 Author: Oleg Broytman <ph...@ph...> Date: Thu Mar 5 02:28:36 2015 +0300 Merge pull request #107 from drnlm/fix_test_unicode Fix test unicode http://sourceforge.net/p/sqlobject/sqlobject/ci/a05eb21b45515709f824f63a2f3db0d4286cb315 commit a05eb21b45515709f824f63a2f3db0d4286cb315 Author: Neil <drn...@gm...> Date: Wed Mar 4 18:06:30 2015 +0200 Skip dbEncoding test on python 3 diff --git a/sqlobject/tests/test_unicode.py b/sqlobject/tests/test_unicode.py index 76ffada..768e0a1 100644 --- a/sqlobject/tests/test_unicode.py +++ b/sqlobject/tests/test_unicode.py @@ -1,4 +1,5 @@ import sys +import py.test from sqlobject import * from sqlobject.tests.dbtest import * @@ -100,6 +101,9 @@ def test_select(): def test_dbEncoding(): + if sys.version_info[0] > 2: + # Python 3 mostly ignores dbEncoding + py.test.skip("This test is for python 2") setup() TestUnicode.sqlmeta.dbEncoding = 'utf-8' _test_select() http://sourceforge.net/p/sqlobject/sqlobject/ci/510e58c1313eb0fc660183bdf0256b8063959fa0 commit 510e58c1313eb0fc660183bdf0256b8063959fa0 Author: Neil <drn...@gm...> Date: Wed Mar 4 18:06:13 2015 +0200 Compare against actual strings on python 3 diff --git a/sqlobject/tests/test_unicode.py b/sqlobject/tests/test_unicode.py index 8ad5468..76ffada 100644 --- a/sqlobject/tests/test_unicode.py +++ b/sqlobject/tests/test_unicode.py @@ -1,3 +1,5 @@ +import sys + from sqlobject import * from sqlobject.tests.dbtest import * @@ -39,9 +41,15 @@ def test_create(): FROM test_unicode ORDER BY count """) - for count, col1, col2 in rows: - assert data[count].encode('utf-8') == col1 - assert data[count].encode('latin1') == col2 + if sys.version_info[0] == 2: + for count, col1, col2 in rows: + assert data[count].encode('utf-8') == col1 + assert data[count].encode('latin1') == col2 + else: + # On python 3, everthings already decoded to unicode + for count, col1, col2 in rows: + assert data[count] == col1 + assert data[count] == col2 def _test_select(): ----------------------------------------------------------------------- Summary of changes: sqlobject/tests/test_unicode.py | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-04 13:40:27
|
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 4ac1463aedf9e4fdb7a898d4b02c2f199148b70a (commit) from 8223b12914d5c0bfb07443d5f3eb3d510b83907b (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/4ac1463aedf9e4fdb7a898d4b02c2f199148b70a commit 4ac1463aedf9e4fdb7a898d4b02c2f199148b70a Author: Oleg Broytman <ph...@ph...> Date: Wed Mar 4 16:08:12 2015 +0300 Force charset for MySQL to be utf8 Default charset for MySQL is latin-1. diff --git a/tox.ini b/tox.ini index a949dff..4497785 100644 --- a/tox.ini +++ b/tox.ini @@ -71,7 +71,7 @@ commands = [testenv:py34-mysqlclient] commands = mysql -e 'create database sqlobject_test;' - py.test -D mysql://root:@localhost/sqlobject_test + py.test -D mysql://root:@localhost/sqlobject_test?charset=utf8 mysql -e 'drop database sqlobject_test;' [testenv:py27-flake8] ----------------------------------------------------------------------- Summary of changes: tox.ini | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-03-03 18:43:57
|
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 |
From: Oleg B. <no...@so...> - 2015-03-02 18:27:31
|
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 3656877ae44c7b48b98baf0c7c9b9ae0f5ce924c (commit) via f4ccb2cd80dc1dc84280290c560401ba5cc1d8f6 (commit) via e6ea796bc9358e657f58f59f24f1465c80ba41ab (commit) via 4967eaeab451a18a678c095863f38c313f9830ec (commit) via c8cb1ff4434770078e828bac86e705b3918a37b2 (commit) via 8d873ac856a1b32a29821fab5d6e388ced7efafd (commit) via c8b19c40ed39a4f6bc8719928c44708484ea8519 (commit) from 4b241b911877afce0f1625fc321faade2d8cfcf1 (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/3656877ae44c7b48b98baf0c7c9b9ae0f5ce924c commit 3656877ae44c7b48b98baf0c7c9b9ae0f5ce924c Merge: 4b241b9 f4ccb2c Author: Oleg Broytman <ph...@ph...> Date: Mon Mar 2 21:26:44 2015 +0300 Merge pull request #103 from drnlm/fix_scripts Fix scripts http://sourceforge.net/p/sqlobject/sqlobject/ci/f4ccb2cd80dc1dc84280290c560401ba5cc1d8f6 commit f4ccb2cd80dc1dc84280290c560401ba5cc1d8f6 Author: Neil <drn...@gm...> Date: Mon Mar 2 11:42:05 2015 +0200 Fix config call diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index 067c09c..9ae271d 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -1102,7 +1102,11 @@ class CommandRecord(Command): def base_dir(self): base = self.options.output_dir if base is None: - base = CONFIG.get('sqlobject_history_dir', '.') # noqa + config = self.config() + if config is not None: + base = config.get('sqlobject_history_dir', '.') + else: + base = '.' if not os.path.exists(base): print('Creating history directory %s' % self.shorten_filename(base)) http://sourceforge.net/p/sqlobject/sqlobject/ci/e6ea796bc9358e657f58f59f24f1465c80ba41ab commit e6ea796bc9358e657f58f59f24f1465c80ba41ab Author: Neil <drn...@gm...> Date: Mon Mar 2 11:17:35 2015 +0200 Rewrite to use os.walk diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index 3502879..067c09c 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -495,7 +495,8 @@ class Command(with_metaclass(DeclarativeMeta, object)): classes = self.classes_from_module(module) all.extend(classes) - os.path.walk(package_dir, find_classes_in_file, None) + for dirpath, dirnames, filenames in os.walk(package_dir): + find_classes_in_file(None, dirpath, dirnames + filenames) return all def classes_from_egg(self, egg_spec): http://sourceforge.net/p/sqlobject/sqlobject/ci/4967eaeab451a18a678c095863f38c313f9830ec commit 4967eaeab451a18a678c095863f38c313f9830ec Author: Neil <drn...@gm...> Date: Mon Mar 2 11:04:53 2015 +0200 Python3 compatibility fix diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index ea8c230..3502879 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -427,7 +427,10 @@ class Command(with_metaclass(DeclarativeMeta, object)): if '#' in conf_fn: conf_fn, conf_section = conf_fn.split('#', 1) - from ConfigParser import ConfigParser + try: + from ConfigParser import ConfigParser + except ImportError: + from configparser import ConfigParser p = ConfigParser() # Case-sensitive: p.optionxform = str http://sourceforge.net/p/sqlobject/sqlobject/ci/c8cb1ff4434770078e828bac86e705b3918a37b2 commit c8cb1ff4434770078e828bac86e705b3918a37b2 Author: Neil <drn...@gm...> Date: Mon Mar 2 11:01:29 2015 +0200 Fix sort issues diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index e7e32b8..ea8c230 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -260,7 +260,7 @@ class Command(with_metaclass(DeclarativeMeta, object)): for cls in classes: level = calculateDependencyLevel(cls) sorter.append((level, cls)) - sorter.sort() + sorter.sort(key=lambda x: x[0]) ordered_classes = [cls for _, cls in sorter] except SQLObjectCircularReferenceError as msg: # Failsafe: return the classes as-is if a circular reference @@ -828,8 +828,7 @@ class CommandHelp(Command): print(' (use "%s help COMMAND" or "%s COMMAND -h" ' % ( self.prog_name, self.prog_name)) print(' for more information)') - items = the_runner.commands.items() - items.sort() + items = sorted(the_runner.commands.items()) max_len = max([len(cn) for cn, c in items]) for command_name, command in items: print('%s:%s %s' % (command_name, @@ -1028,8 +1027,7 @@ class CommandRecord(Command): os.mkdir(output_dir) if v: print('Making directory %s' % self.shorten_filename(output_dir)) - files = files.items() - files.sort() + files = sorted(files.items()) for fn, content in files: if v: print(' Writing %s' % self.shorten_filename(fn)) http://sourceforge.net/p/sqlobject/sqlobject/ci/8d873ac856a1b32a29821fab5d6e388ced7efafd commit 8d873ac856a1b32a29821fab5d6e388ced7efafd Author: Neil <drn...@gm...> Date: Mon Mar 2 11:00:18 2015 +0200 Fix raw_input usage diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index 7b8a9de..e7e32b8 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -28,6 +28,11 @@ warnings.filterwarnings( RuntimeWarning, '.*command', 28) +if sys.version_info[0] == 2: + # noqa for flake8 and python 3 + input = raw_input # noqa + + def nowarning_tempnam(*args, **kw): return os.tempnam(*args, **kw) @@ -546,7 +551,7 @@ class Command(with_metaclass(DeclarativeMeta, object)): else: prompt += ' [y/N]? ' while 1: - response = raw_input(prompt).strip() + response = input(prompt).strip() if not response.strip(): return default if response and response[0].lower() in ('y', 'n'): http://sourceforge.net/p/sqlobject/sqlobject/ci/c8b19c40ed39a4f6bc8719928c44708484ea8519 commit c8b19c40ed39a4f6bc8719928c44708484ea8519 Author: Neil <drn...@gm...> Date: Mon Mar 2 10:58:24 2015 +0200 Update scripts to user print function diff --git a/scripts/sqlobject-admin b/scripts/sqlobject-admin index 69b3e94..59d4b4b 100755 --- a/scripts/sqlobject-admin +++ b/scripts/sqlobject-admin @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import print_function import sys import os @@ -22,8 +23,8 @@ except ImportError: if os.path.exists(updir): sys.path.insert(0, os.path.dirname(updir)) else: - print 'I cannot find the sqlobject module' - print 'If SQLObject is installed, you may need to set $PYTHONPATH' + print('I cannot find the sqlobject module') + print('If SQLObject is installed, you may need to set $PYTHONPATH') sys.exit(3) # Now we have to get rid of possibly stale modules from that import # up there diff --git a/scripts/sqlobject-convertOldURI b/scripts/sqlobject-convertOldURI index f807180..e1c4c47 100755 --- a/scripts/sqlobject-convertOldURI +++ b/scripts/sqlobject-convertOldURI @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import print_function import sys @@ -15,4 +16,4 @@ except (ImportError, pkg_resources.DistributionNotFound): from sqlobject import connectionForURI conn = connectionForURI(uri, oldUri=True) -print conn.uri() +print(conn.uri()) ----------------------------------------------------------------------- Summary of changes: scripts/sqlobject-admin | 5 +++-- scripts/sqlobject-convertOldURI | 3 ++- sqlobject/manager/command.py | 29 ++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 12 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-26 20:44:52
|
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 4b241b911877afce0f1625fc321faade2d8cfcf1 (commit) via 019201f9b1f4f7e77486cb9a07787bfdc43a1c76 (commit) via 2cd507722bebc742338fd82f412cdb1046d5d4ab (commit) via e817be9ee7081c0bd885d36cb937461483c6d9bb (commit) via 6d6dd4ce0d529a448833913d279b425b3dade034 (commit) from e647b7ae7af1bd21fd93da83187ca1250054e454 (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/4b241b911877afce0f1625fc321faade2d8cfcf1 commit 4b241b911877afce0f1625fc321faade2d8cfcf1 Merge: e647b7a 019201f Author: Oleg Broytman <ph...@ph...> Date: Thu Feb 26 23:43:45 2015 +0300 Merge pull request #102 from drnlm/fix_hashcol Fix hashcol http://sourceforge.net/p/sqlobject/sqlobject/ci/019201f9b1f4f7e77486cb9a07787bfdc43a1c76 commit 019201f9b1f4f7e77486cb9a07787bfdc43a1c76 Author: Neil <drn...@gm...> Date: Thu Feb 26 22:23:45 2015 +0200 Use def to make flake8 happy diff --git a/sqlobject/include/tests/test_hashcol.py b/sqlobject/include/tests/test_hashcol.py index e0a0d19..0e9794c 100644 --- a/sqlobject/include/tests/test_hashcol.py +++ b/sqlobject/include/tests/test_hashcol.py @@ -9,11 +9,17 @@ from hashlib import sha256, md5 ######################################## if sys.version_info[0] == 2: - sha256_str = lambda x: sha256(x).hexdigest() - md5_str = lambda x: md5(x).hexdigest() + def sha256_str(x): + return sha256(x).hexdigest() + + def md5_str(x): + return md5(x).hexdigest() else: - sha256_str = lambda x: sha256(x.encode('utf8')).hexdigest() - md5_str = lambda x: md5(x.encode('utf8')).hexdigest() + def sha256_str(x): + return sha256(x.encode('utf8')).hexdigest() + + def md5_str(x): + return md5(x.encode('utf8')).hexdigest() class HashTest(SQLObject): http://sourceforge.net/p/sqlobject/sqlobject/ci/2cd507722bebc742338fd82f412cdb1046d5d4ab commit 2cd507722bebc742338fd82f412cdb1046d5d4ab Author: Neil <drn...@gm...> Date: Thu Feb 26 21:28:29 2015 +0200 Rework to handle python 3 encoding issues diff --git a/sqlobject/include/hashcol.py b/sqlobject/include/hashcol.py index 0e98937..d0e55a1 100644 --- a/sqlobject/include/hashcol.py +++ b/sqlobject/include/hashcol.py @@ -1,3 +1,4 @@ +import sys import sqlobject.col from sqlobject.compat import string_type @@ -82,7 +83,10 @@ class SOHashCol(sqlobject.col.SOStringCol): def __init__(self, **kw): if 'hashMethod' not in kw: from hashlib import md5 - self.hashMethod = lambda v: md5(v).hexdigest() + if sys.version_info[0] == 2: + self.hashMethod = lambda v: md5(v).hexdigest() + else: + self.hashMethod = lambda v: md5(v.encode('utf8')).hexdigest() if 'length' not in kw: kw['length'] = 32 else: diff --git a/sqlobject/include/tests/test_hashcol.py b/sqlobject/include/tests/test_hashcol.py index dcba622..e0a0d19 100644 --- a/sqlobject/include/tests/test_hashcol.py +++ b/sqlobject/include/tests/test_hashcol.py @@ -1,3 +1,4 @@ +import sys from sqlobject import * from sqlobject.tests.dbtest import * from sqlobject.include import hashcol @@ -7,7 +8,12 @@ from hashlib import sha256, md5 # HashCol test ######################################## -sha256_str = lambda x: sha256(x).hexdigest() +if sys.version_info[0] == 2: + sha256_str = lambda x: sha256(x).hexdigest() + md5_str = lambda x: md5(x).hexdigest() +else: + sha256_str = lambda x: sha256(x.encode('utf8')).hexdigest() + md5_str = lambda x: md5(x.encode('utf8')).hexdigest() class HashTest(SQLObject): @@ -41,7 +47,7 @@ def test_create(): ORDER BY count """) for count, col1, col2 in rows: - assert md5(data[count]).hexdigest() == col1 + assert md5_str(data[count]) == col1 assert sha256_str(data[count]) == col2 http://sourceforge.net/p/sqlobject/sqlobject/ci/e817be9ee7081c0bd885d36cb937461483c6d9bb commit e817be9ee7081c0bd885d36cb937461483c6d9bb Author: Neil <drn...@gm...> Date: Thu Feb 26 21:27:33 2015 +0200 Rewrite hashcol to use rich comparison diff --git a/sqlobject/include/hashcol.py b/sqlobject/include/hashcol.py index 18aeddf..0e98937 100644 --- a/sqlobject/include/hashcol.py +++ b/sqlobject/include/hashcol.py @@ -13,15 +13,48 @@ class DbHash: self.hash = hash self.hashMethod = hashMethod - def __cmp__(self, other): - if other is None: - if self.hash is None: - return 0 - return True + def _get_key(self, other): + """Create the hash of the other class""" if not isinstance(other, string_type): raise TypeError( "A hash may only be compared with a string, or None.") - return cmp(self.hashMethod(other), self.hash) + return self.hashMethod(other) + + def __eq__(self, other): + if other is None: + if self.hash is None: + return True + return False + other_key = self._get_key(other) + return other_key == self.hash + + def __lt__(self, other): + if other is None: + return False + other_key = self._get_key(other) + return other_key < self.hash + + def __gt__(self, other): + if other is None: + if self.hash is None: + return False + return True + other_key = self._get_key(other) + return other_key > self.hash + + def __le__(self, other): + if other is None: + if self.hash is None: + return True + return False + other_key = self._get_key(other) + return other_key <= self.hash + + def __ge__(self, other): + if other is None: + return True + other_key = self._get_key(other) + return other_key >= self.hash def __repr__(self): return "<DbHash>" http://sourceforge.net/p/sqlobject/sqlobject/ci/6d6dd4ce0d529a448833913d279b425b3dade034 commit 6d6dd4ce0d529a448833913d279b425b3dade034 Author: Neil <drn...@gm...> Date: Thu Feb 26 21:13:36 2015 +0200 Add test case for HashCol diff --git a/sqlobject/include/tests/__init__.py b/sqlobject/include/tests/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/sqlobject/include/tests/__init__.py @@ -0,0 +1 @@ +# diff --git a/sqlobject/include/tests/test_hashcol.py b/sqlobject/include/tests/test_hashcol.py new file mode 100644 index 0000000..dcba622 --- /dev/null +++ b/sqlobject/include/tests/test_hashcol.py @@ -0,0 +1,72 @@ +from sqlobject import * +from sqlobject.tests.dbtest import * +from sqlobject.include import hashcol +from hashlib import sha256, md5 + +######################################## +# HashCol test +######################################## + +sha256_str = lambda x: sha256(x).hexdigest() + + +class HashTest(SQLObject): + count = IntCol(alternateID=True) + col1 = hashcol.HashCol() + col2 = hashcol.HashCol(hashMethod=sha256_str) + + +data = ['test', 'This is more text', 'test 2'] +items = [] + + +def setup(): + global items + items = [] + setupClass(HashTest) + for i, s in enumerate(data): + items.append(HashTest(count=i, col1=s, col2=s)) + + +def test_create(): + setup() + for s, item in zip(data, items): + assert item.col1 == s + assert item.col2 == s + + conn = HashTest._connection + rows = conn.queryAll(""" + SELECT count, col1, col2 + FROM hash_test + ORDER BY count + """) + for count, col1, col2 in rows: + assert md5(data[count]).hexdigest() == col1 + assert sha256_str(data[count]) == col2 + + +def test_select(): + for i, value in enumerate(data): + rows = list(HashTest.select(HashTest.q.col1 == value)) + assert len(rows) == 1 + rows = list(HashTest.select(HashTest.q.col2 == value)) + assert len(rows) == 1 + # Passing the hash in directly should fail + rows = list(HashTest.select(HashTest.q.col2 == sha256_str(value))) + assert len(rows) == 0 + rows = list(HashTest.select(AND( + HashTest.q.col1 == value, + HashTest.q.col2 == value + ))) + assert len(rows) == 1 + rows = list(HashTest.selectBy(col1=value)) + assert len(rows) == 1 + rows = list(HashTest.selectBy(col2=value)) + assert len(rows) == 1 + rows = list(HashTest.selectBy(col1=value, col2=value)) + assert len(rows) == 1 + rows = list(HashTest.select(OR( + HashTest.q.col1 == 'test 2', + HashTest.q.col2 == 'test' + ))) + assert len(rows) == 2 ----------------------------------------------------------------------- Summary of changes: sqlobject/include/hashcol.py | 51 +++++++++++++++--- sqlobject/include/{ => tests}/__init__.py | 0 sqlobject/include/tests/test_hashcol.py | 84 +++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 7 deletions(-) copy sqlobject/include/{ => tests}/__init__.py (100%) create mode 100644 sqlobject/include/tests/test_hashcol.py hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-26 19:17:55
|
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 e647b7ae7af1bd21fd93da83187ca1250054e454 (commit) via 71aba5018d2b0f853c305faa66bec88540ec367f (commit) via a6e8fa8dadd2bd0a72297631cb9b3b33e64a97a0 (commit) via b7acfd9247fd748c0a8598544180f9523373c6ea (commit) via 97c84567cf6f0138a51c78d02912c666f7f719b5 (commit) from 682d1e95bbefaa540483d23d6a849eab6e42cf38 (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/e647b7ae7af1bd21fd93da83187ca1250054e454 commit e647b7ae7af1bd21fd93da83187ca1250054e454 Merge: 71aba50 97c8456 Author: Oleg Broytman <ph...@ph...> Date: Thu Feb 26 22:16:40 2015 +0300 Merge pull request #101 from drnlm/py34_protect_compat_flake8 Flag python2 compatibility definitions for flake8 http://sourceforge.net/p/sqlobject/sqlobject/ci/71aba5018d2b0f853c305faa66bec88540ec367f commit 71aba5018d2b0f853c305faa66bec88540ec367f Merge: 682d1e9 a6e8fa8 Author: Oleg Broytman <ph...@ph...> Date: Thu Feb 26 22:15:13 2015 +0300 Merge pull request #100 from drnlm/update_doctests Update doctests http://sourceforge.net/p/sqlobject/sqlobject/ci/a6e8fa8dadd2bd0a72297631cb9b3b33e64a97a0 commit a6e8fa8dadd2bd0a72297631cb9b3b33e64a97a0 Author: Neil <drn...@gm...> Date: Thu Feb 26 12:02:37 2015 +0200 Rework select documention to move selections involving joins after the discussion on relationships diff --git a/docs/SQLObject.txt b/docs/SQLObject.txt index 2d7057e..d4bb0b4 100644 --- a/docs/SQLObject.txt +++ b/docs/SQLObject.txt @@ -355,16 +355,19 @@ that's generated):: 1/COMMIT : auto [<Person 1 firstName='John' middleInitial='Q' lastName='Doe'>] -This example returns everyone with the first name John. An expression -could be more complicated as well, like:: +This example returns everyone with the first name John. + +Queries can be more complex:: >>> peeps = Person.select( - ... AND(Address.q.personID == Person.q.id, - ... Address.q.zip.startswith('504'))) + ... OR(Person.q.firstName == "John", + ... LIKE(Person.q.lastName, "%Hope%"))) >>> list(peeps) - 1/Select : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person, address WHERE ((address.person_id = person.id) AND (address.zip LIKE '504%')) + 1/Select : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person WHERE (((person.first_name) = ('John')) OR (person.last_name LIKE ('%Hope%'))) + 1/QueryR : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person WHERE (((person.first_name) = ('John')) OR (person.last_name LIKE ('%Hope%'))) 1/COMMIT : auto - [] + [<Person 1 firstName='John' middleInitial='Q' lastName='Doe'>, <Person 2 firstName='Robert' middleInitial='Q' lastName='Hope Jr.'>] + You'll note that classes have an attribute ``q``, which gives access to special objects for constructing query clauses. All attributes @@ -372,15 +375,10 @@ under ``q`` refer to column names and if you construct logical statements with these it'll give you the SQL for that statement. You can also create your SQL more manually:: - >>> Person._connection.debug = False # Needed for doctests - >>> peeps = Person.select("""address.person_id = person.id AND - ... address.zip LIKE '504%'""", - ... clauseTables=['address']) + >>> Person._connection.debug = False # Need for doctests + >>> peeps = Person.select("""person.first_name = 'John' AND + ... person.last_name LIKE 'D%'""") -Note that you have to use ``clauseTables`` if you use tables besides -the one you are selecting from. If you use the ``q`` attributes -SQLObject will automatically figure out what extra classes you might -have used. You should use `MyClass.sqlrepr` to quote any values you use if you create SQL manually (quoting is automatic if you use ``q``). @@ -696,6 +694,38 @@ keyword argument to override this). Its use: >>> Role.byName('admin') <Role 1 name='admin'> + +Selecting Objects Using Relationships +------------------------------------- + +An select expression can refer to multiple classes, like:: + + >>> Person._connection.debug = False # Needed for doctests + >>> peeps = Person.select( + ... AND(Address.q.personID == Person.q.id, + ... Address.q.zip.startswith('504'))) + >>> list(peeps) + [] + >>> peeps = Person.select( + ... AND(Address.q.personID == Person.q.id, + ... Address.q.zip.startswith('554'))) + >>> list(peeps) + [<Person 2 firstName='Robert' middleInitial='Q' lastName='Hope Jr.'>] + + +It is also possible to use the ``q`` attribute when constructing complex +queries, like:: + + >>> Person._connection.debug = False # Needed for doctests + >>> peeps = Person.select("""address.person_id = person.id AND + ... address.zip LIKE '504%'""", + ... clauseTables=['address']) + +Note that you have to use ``clauseTables`` if you use tables besides +the one you are selecting from. If you use the ``q`` attributes +SQLObject will automatically figure out what extra classes you might +have used. + Class sqlmeta ------------- http://sourceforge.net/p/sqlobject/sqlobject/ci/b7acfd9247fd748c0a8598544180f9523373c6ea commit b7acfd9247fd748c0a8598544180f9523373c6ea Author: Neil <drn...@gm...> Date: Thu Feb 26 12:07:17 2015 +0200 Update doctests to reflect correct order after d8cc22debdd diff --git a/docs/SQLObject.txt b/docs/SQLObject.txt index 42663e9..2d7057e 100644 --- a/docs/SQLObject.txt +++ b/docs/SQLObject.txt @@ -301,8 +301,8 @@ same actions with the SQL that is sent, along with some commentary:: >>> # This will make SQLObject print out the SQL it executes: >>> Person._connection.debug = True >>> p = Person(firstName='Bob', lastName='Hope') - 1/QueryIns: INSERT INTO person (last_name, middle_initial, first_name) VALUES ('Hope', NULL, 'Bob') - 1/QueryR : INSERT INTO person (last_name, middle_initial, first_name) VALUES ('Hope', NULL, 'Bob') + 1/QueryIns: INSERT INTO person (first_name, middle_initial, last_name) VALUES ('Bob', NULL, 'Hope') + 1/QueryR : INSERT INTO person (first_name, middle_initial, last_name) VALUES ('Bob', NULL, 'Hope') 1/COMMIT : auto 1/QueryOne: SELECT first_name, middle_initial, last_name FROM person WHERE ((person.id) = (2)) 1/QueryR : SELECT first_name, middle_initial, last_name FROM person WHERE ((person.id) = (2)) http://sourceforge.net/p/sqlobject/sqlobject/ci/97c84567cf6f0138a51c78d02912c666f7f719b5 commit 97c84567cf6f0138a51c78d02912c666f7f719b5 Author: Neil <drn...@gm...> Date: Thu Feb 26 11:03:57 2015 +0200 Flag python2 compatibility definitions for flake8 diff --git a/sqlobject/compat.py b/sqlobject/compat.py index e975486..fe7b8d4 100644 --- a/sqlobject/compat.py +++ b/sqlobject/compat.py @@ -18,10 +18,11 @@ def with_metaclass(meta, *bases): # Compatability definitions (inspired by six) if sys.version_info[0] < 3: - string_type = basestring - unicode_type = unicode + # disable flake8 checks on python 3 + string_type = basestring # noqa + unicode_type = unicode # noqa class_types = (type, types.ClassType) - buffer_type = buffer + buffer_type = buffer # noqa else: string_type = str unicode_type = str diff --git a/sqlobject/converters.py b/sqlobject/converters.py index 8757e40..1383c41 100644 --- a/sqlobject/converters.py +++ b/sqlobject/converters.py @@ -96,7 +96,8 @@ def StringLikeConverter(value, db): registerConverter(str, StringLikeConverter) if sys.version_info[0] < 3: - registerConverter(unicode, StringLikeConverter) + # noqa for flake8 & python3 + registerConverter(unicode, StringLikeConverter) # noqa registerConverter(array, StringLikeConverter) if sys.version_info[0] < 3: registerConverter(buffer_type, StringLikeConverter) @@ -114,7 +115,8 @@ def LongConverter(value, db): return str(value) if sys.version_info[0] < 3: - registerConverter(long, LongConverter) + # noqa for flake8 & python3 + registerConverter(long, LongConverter) # noqa if NumericType: registerConverter(NumericType, IntConverter) ----------------------------------------------------------------------- Summary of changes: docs/SQLObject.txt | 62 ++++++++++++++++++++++++++++++++++------------ sqlobject/compat.py | 7 +++-- sqlobject/converters.py | 6 +++- 3 files changed, 54 insertions(+), 21 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-25 16:29:38
|
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 682d1e95bbefaa540483d23d6a849eab6e42cf38 (commit) via 3ebe1ec5c7ddab3499625dc3b3b3145c949ec4e2 (commit) via d5009b510c2faaa618e8035ec23120049d8ad921 (commit) via eb9066fd575b8d007f2cc4bd6aa947cb646efae1 (commit) via d153fda0f745d2968fdc6e19eb8f576b5752a8b9 (commit) via e5ddaf070d61c7692835dfb666e507fc7cd42ec3 (commit) from ed85db037fb956d542a14fa01c92a973941dd7b3 (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/682d1e95bbefaa540483d23d6a849eab6e42cf38 commit 682d1e95bbefaa540483d23d6a849eab6e42cf38 Merge: 3ebe1ec d5009b5 Author: Oleg Broytman <ph...@ph...> Date: Wed Feb 25 19:28:47 2015 +0300 Merge pull request #99 from drnlm/fix_test_constraints Update test to python3 behaviour http://sourceforge.net/p/sqlobject/sqlobject/ci/3ebe1ec5c7ddab3499625dc3b3b3145c949ec4e2 commit 3ebe1ec5c7ddab3499625dc3b3b3145c949ec4e2 Merge: ed85db0 eb9066f Author: Oleg Broytman <ph...@ph...> Date: Wed Feb 25 19:26:37 2015 +0300 Merge pull request #98 from drnlm/rework_blob_columns Rework blob columns http://sourceforge.net/p/sqlobject/sqlobject/ci/d5009b510c2faaa618e8035ec23120049d8ad921 commit d5009b510c2faaa618e8035ec23120049d8ad921 Author: Neil <drn...@gm...> Date: Wed Feb 25 15:49:30 2015 +0200 Update test to python3 behaviour diff --git a/sqlobject/tests/test_constraints.py b/sqlobject/tests/test_constraints.py index 89a03fc..cddf247 100644 --- a/sqlobject/tests/test_constraints.py +++ b/sqlobject/tests/test_constraints.py @@ -12,8 +12,11 @@ def test_constraints(): col = Dummy(name='col') isString(obj, col, 'blah') raises(BadValue, isString, obj, col, 1) - # @@: Should this really be an error? - raises(BadValue, isString, obj, col, u'test!') + if sys.version_info[0] == 2: + # @@: Should this really be an error? + raises(BadValue, isString, obj, col, u'test!') + else: + raises(BadValue, isString, obj, col, b'test!') # isString(obj, col, u'test!') raises(BadValue, notNull, obj, col, None) http://sourceforge.net/p/sqlobject/sqlobject/ci/eb9066fd575b8d007f2cc4bd6aa947cb646efae1 commit eb9066fd575b8d007f2cc4bd6aa947cb646efae1 Author: Neil <drn...@gm...> Date: Wed Feb 25 13:55:46 2015 +0200 Update picklecol to expect bytes in python 3 diff --git a/sqlobject/col.py b/sqlobject/col.py index fd8621d..28e5693 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -1752,7 +1752,7 @@ class PickleValidator(BinaryValidator): if isinstance(value, unicode_type): dbEncoding = self.getDbEncoding(state, default='ascii') value = value.encode(dbEncoding) - if isinstance(value, str): + if isinstance(value, bytes): return pickle.loads(value) raise validators.Invalid( "expected a pickle string in the PickleCol '%s', " http://sourceforge.net/p/sqlobject/sqlobject/ci/d153fda0f745d2968fdc6e19eb8f576b5752a8b9 commit d153fda0f745d2968fdc6e19eb8f576b5752a8b9 Author: Neil <drn...@gm...> Date: Wed Feb 25 13:55:22 2015 +0200 Rework BinaryValidator to deal in bytes and handle memoryviews in python 3 diff --git a/sqlobject/col.py b/sqlobject/col.py index 6a4670e..fd8621d 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -1671,6 +1671,8 @@ class BinaryValidator(SOValidator): binaryType = connection._binaryType if isinstance(value, str): if dbName == "sqlite": + if sys.version_info[0] > 2: + value = bytes(value, 'ascii') value = connection.module.decode(value) return value if isinstance(value, (buffer_type, binaryType)): @@ -1679,6 +1681,8 @@ class BinaryValidator(SOValidator): return cachedValue[0] if isinstance(value, array): # MySQL return value.tostring() + if sys.version_info[0] > 2 and isinstance(value, memoryview): + return value.tobytes() return str(value) # buffer => string raise validators.Invalid( "expected a string in the BLOBCol '%s', got %s %r instead" % ( @@ -1689,6 +1693,8 @@ class BinaryValidator(SOValidator): return None connection = state.connection or state.soObject._connection binary = connection.createBinary(value) + if sys.version_info[0] > 2 and isinstance(binary, memoryview): + binary = str(binary.tobytes(), 'ascii') self._cachedValue = (value, binary) return binary http://sourceforge.net/p/sqlobject/sqlobject/ci/e5ddaf070d61c7692835dfb666e507fc7cd42ec3 commit e5ddaf070d61c7692835dfb666e507fc7cd42ec3 Author: Neil <drn...@gm...> Date: Wed Feb 25 13:53:17 2015 +0200 Tweak test_blob to use bytes diff --git a/sqlobject/tests/test_blob.py b/sqlobject/tests/test_blob.py index c4cf566..584b2ad 100644 --- a/sqlobject/tests/test_blob.py +++ b/sqlobject/tests/test_blob.py @@ -1,3 +1,4 @@ +import sys import py.test from sqlobject import * from sqlobject.tests.dbtest import * @@ -9,14 +10,17 @@ from sqlobject.tests.dbtest import * class ImageData(SQLObject): - image = BLOBCol(default='emptydata', length=65535) + image = BLOBCol(default=b'emptydata', length=65535) def test_BLOBCol(): if not supports('blobData'): py.test.skip("blobData isn't supported") setupClass(ImageData) - data = ''.join([chr(x) for x in range(256)]) + if sys.version_info[0] == 2: + data = ''.join([chr(x) for x in range(256)]) + else: + data = bytes(range(256)) prof = ImageData() prof.image = data ----------------------------------------------------------------------- Summary of changes: sqlobject/col.py | 8 +++++++- sqlobject/tests/test_blob.py | 8 ++++++-- sqlobject/tests/test_constraints.py | 7 +++++-- 3 files changed, 18 insertions(+), 5 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-25 00:19:01
|
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 ed85db037fb956d542a14fa01c92a973941dd7b3 (commit) via c40e7ca7fb54c3c671dbe1415e6551b25140a0a3 (commit) from c27eead21bc8db3a923515568738b51e0d5f7adc (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/ed85db037fb956d542a14fa01c92a973941dd7b3 commit ed85db037fb956d542a14fa01c92a973941dd7b3 Merge: c27eead c40e7ca Author: Oleg Broytman <ph...@ph...> Date: Wed Feb 25 03:18:19 2015 +0300 Merge pull request #97 from drnlm/fix_test_auto Only encode column names on python 2 http://sourceforge.net/p/sqlobject/sqlobject/ci/c40e7ca7fb54c3c671dbe1415e6551b25140a0a3 commit c40e7ca7fb54c3c671dbe1415e6551b25140a0a3 Author: Neil <drn...@gm...> Date: Tue Feb 24 22:58:21 2015 +0200 Only encode column names on python 2 diff --git a/sqlobject/main.py b/sqlobject/main.py index 6b793ef..276ec1c 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -475,7 +475,8 @@ class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)): conn = connection or soClass._connection for columnDef in conn.columnsFromSchema(sqlmeta.table, soClass): if columnDef.name not in sqlmeta.columnDefinitions: - if isinstance(columnDef.name, unicode_type): + if isinstance(columnDef.name, unicode_type) and \ + sys.version_info[0] == 2: columnDef.name = columnDef.name.encode('ascii') sqlmeta.addColumn(columnDef) ----------------------------------------------------------------------- Summary of changes: sqlobject/main.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-24 18:53:52
|
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 c27eead21bc8db3a923515568738b51e0d5f7adc (commit) via cc83a31214ce42bc9c43e9db8c3cc3c516535b23 (commit) via a89bdbc2ca38fb6afdda40c93679f4e738fb40e7 (commit) via 0a3a107b74929d92e86f8cda0084c0373689af1d (commit) via 80c679f93ac0a4af362a63f4ecbae11aa1b0abbe (commit) from bc89f66a64b910f0cb99a840ce804d458bcdddcc (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/c27eead21bc8db3a923515568738b51e0d5f7adc commit c27eead21bc8db3a923515568738b51e0d5f7adc Merge: bc89f66 cc83a31 Author: Oleg Broytman <ph...@ph...> Date: Tue Feb 24 21:52:48 2015 +0300 Merge pull request #96 from drnlm/cmp_rewrite Cmp rewrite http://sourceforge.net/p/sqlobject/sqlobject/ci/cc83a31214ce42bc9c43e9db8c3cc3c516535b23 commit cc83a31214ce42bc9c43e9db8c3cc3c516535b23 Author: Neil <drn...@gm...> Date: Tue Feb 24 16:26:22 2015 +0200 Rename the class to make py.test happy (or why I should run the full test suite more often) diff --git a/sqlobject/tests/test_complex_sorting.py b/sqlobject/tests/test_complex_sorting.py index 691f6bd..387fd6b 100644 --- a/sqlobject/tests/test_complex_sorting.py +++ b/sqlobject/tests/test_complex_sorting.py @@ -4,7 +4,7 @@ from sqlobject.tests.dbtest import * # Test more complex orderBy clauses -class Names(SQLObject): +class ComplexNames(SQLObject): class sqlmeta(sqlmeta): table = 'names_table' @@ -16,13 +16,13 @@ class Names(SQLObject): age = IntCol() -def setupNames(): - setupClass(Names) - inserts(Names, [('aj', 'baker', '555-444-333', 34), - ('joe', 'robbins', '444-555-333', 34), - ('tim', 'jackson', '555-444-222', 32), - ('joe', 'baker', '222-111-000', 24), - ('zoe', 'robbins', '444-555-333', 46)], +def setupComplexNames(): + setupClass(ComplexNames) + inserts(ComplexNames, [('aj', 'baker', '555-444-333', 34), + ('joe', 'robbins', '444-555-333', 34), + ('tim', 'jackson', '555-444-222', 32), + ('joe', 'baker', '222-111-000', 24), + ('zoe', 'robbins', '444-555-333', 46)], schema='firstName lastName phone age') @@ -37,38 +37,41 @@ def firstList(names): return [n.firstName for n in names] -def test_defaultOrder(): - setupNames() - assert nameList(Names.select()) == \ +def test_defaultComplexOrder(): + setupComplexNames() + assert nameList(ComplexNames.select()) == \ ['aj baker', 'joe baker', 'tim jackson', 'joe robbins', 'zoe robbins'] def test_complexOrders(): - setupNames() - assert nameList(Names.select().orderBy(['age', 'phone', - 'firstName', 'lastName'])) == \ + setupComplexNames() + assert nameList(ComplexNames.select().orderBy(['age', 'phone', + 'firstName', + 'lastName'])) == \ ['joe baker', 'tim jackson', 'joe robbins', 'aj baker', 'zoe robbins'] - assert nameList(Names.select().orderBy(['-age', 'phone', - 'firstName', 'lastName'])) == \ + assert nameList(ComplexNames.select().orderBy(['-age', 'phone', + 'firstName', + 'lastName'])) == \ ['zoe robbins', 'joe robbins', 'aj baker', 'tim jackson', 'joe baker'] - assert nameList(Names.select().orderBy(['age', '-phone', - 'firstName', 'lastName'])) == \ + assert nameList(ComplexNames.select().orderBy(['age', '-phone', + 'firstName', + 'lastName'])) == \ ['joe baker', 'tim jackson', 'aj baker', 'joe robbins', 'zoe robbins'] - assert nameList(Names.select().orderBy(['-firstName', 'phone', - 'lastName', 'age'])) == \ + assert nameList(ComplexNames.select().orderBy(['-firstName', 'phone', + 'lastName', 'age'])) == \ ['zoe robbins', 'tim jackson', 'joe baker', 'joe robbins', 'aj baker'] - assert nameList(Names.select().orderBy(['-firstName', '-phone', - 'lastName', 'age'])) == \ + assert nameList(ComplexNames.select().orderBy(['-firstName', '-phone', + 'lastName', 'age'])) == \ ['zoe robbins', 'tim jackson', 'joe robbins', 'joe baker', 'aj baker'] http://sourceforge.net/p/sqlobject/sqlobject/ci/a89bdbc2ca38fb6afdda40c93679f4e738fb40e7 commit a89bdbc2ca38fb6afdda40c93679f4e738fb40e7 Author: Neil <drn...@gm...> Date: Tue Feb 24 16:04:54 2015 +0200 Fix flake8 error diff --git a/sqlobject/tests/test_complex_sorting.py b/sqlobject/tests/test_complex_sorting.py index a93e52f..691f6bd 100644 --- a/sqlobject/tests/test_complex_sorting.py +++ b/sqlobject/tests/test_complex_sorting.py @@ -3,6 +3,7 @@ from sqlobject.tests.dbtest import * # Test more complex orderBy clauses + class Names(SQLObject): class sqlmeta(sqlmeta): http://sourceforge.net/p/sqlobject/sqlobject/ci/0a3a107b74929d92e86f8cda0084c0373689af1d commit 0a3a107b74929d92e86f8cda0084c0373689af1d Author: Neil <drn...@gm...> Date: Tue Feb 24 16:00:50 2015 +0200 Extra sorting test case diff --git a/sqlobject/tests/test_complex_sorting.py b/sqlobject/tests/test_complex_sorting.py new file mode 100644 index 0000000..a93e52f --- /dev/null +++ b/sqlobject/tests/test_complex_sorting.py @@ -0,0 +1,73 @@ +from sqlobject import * +from sqlobject.tests.dbtest import * + +# Test more complex orderBy clauses + +class Names(SQLObject): + + class sqlmeta(sqlmeta): + table = 'names_table' + defaultOrder = ['lastName', 'firstName', 'phone', 'age'] + + firstName = StringCol(length=30) + lastName = StringCol(length=30) + phone = StringCol(length=11) + age = IntCol() + + +def setupNames(): + setupClass(Names) + inserts(Names, [('aj', 'baker', '555-444-333', 34), + ('joe', 'robbins', '444-555-333', 34), + ('tim', 'jackson', '555-444-222', 32), + ('joe', 'baker', '222-111-000', 24), + ('zoe', 'robbins', '444-555-333', 46)], + schema='firstName lastName phone age') + + +def nameList(names): + result = [] + for name in names: + result.append('%s %s' % (name.firstName, name.lastName)) + return result + + +def firstList(names): + return [n.firstName for n in names] + + +def test_defaultOrder(): + setupNames() + assert nameList(Names.select()) == \ + ['aj baker', 'joe baker', + 'tim jackson', 'joe robbins', + 'zoe robbins'] + + +def test_complexOrders(): + setupNames() + assert nameList(Names.select().orderBy(['age', 'phone', + 'firstName', 'lastName'])) == \ + ['joe baker', 'tim jackson', + 'joe robbins', 'aj baker', + 'zoe robbins'] + assert nameList(Names.select().orderBy(['-age', 'phone', + 'firstName', 'lastName'])) == \ + ['zoe robbins', 'joe robbins', + 'aj baker', 'tim jackson', + 'joe baker'] + assert nameList(Names.select().orderBy(['age', '-phone', + 'firstName', 'lastName'])) == \ + ['joe baker', 'tim jackson', + 'aj baker', 'joe robbins', + 'zoe robbins'] + assert nameList(Names.select().orderBy(['-firstName', 'phone', + 'lastName', 'age'])) == \ + ['zoe robbins', 'tim jackson', + 'joe baker', 'joe robbins', + 'aj baker'] + assert nameList(Names.select().orderBy(['-firstName', '-phone', + 'lastName', 'age'])) == \ + ['zoe robbins', 'tim jackson', + 'joe robbins', 'joe baker', + 'aj baker'] http://sourceforge.net/p/sqlobject/sqlobject/ci/80c679f93ac0a4af362a63f4ecbae11aa1b0abbe commit 80c679f93ac0a4af362a63f4ecbae11aa1b0abbe Author: Neil <drn...@gm...> Date: Fri Feb 13 11:08:10 2015 +0200 rewrite orderby to avoid cmp diff --git a/sqlobject/joins.py b/sqlobject/joins.py index 17ae613..675beb7 100644 --- a/sqlobject/joins.py +++ b/sqlobject/joins.py @@ -96,19 +96,48 @@ class SOJoin(object): def _applyOrderBy(self, results, defaultSortClass): if self.orderBy is not None: - results.sort(sorter(self.orderBy)) + doSort(results, self.orderBy) return results -def sorter(orderBy): +class MinType(object): + """Sort less than everything, for handling None's in the results""" + # functools.total_ordering would simplify this, but isn't available + # for python 2.6 + + def __lt__(self, other): + if self is other: + return False + return True + + def __eq__(self, other): + return self is other + + def __gt__(self, other): + return False + + def __le__(self, other): + return True + + def __ge__(self, other): + if self is other: + return True + return False + + +Min = MinType() + + +def doSort(results, orderBy): if isinstance(orderBy, (tuple, list)): if len(orderBy) == 1: orderBy = orderBy[0] else: - fhead = sorter(orderBy[0]) - frest = sorter(orderBy[1:]) - return lambda a, b, fhead=fhead, frest=frest: \ - fhead(a, b) or frest(a, b) + # Rely on stable sort results, since this is simpler + # than trying to munge everything into a single sort key + doSort(results, orderBy[0]) + doSort(results, orderBy[1:]) + return if isinstance(orderBy, sqlbuilder.DESC) \ and isinstance(orderBy.expr, sqlbuilder.SQLObjectField): orderBy = '-' + orderBy.expr.original @@ -121,19 +150,12 @@ def sorter(orderBy): else: reverse = False - def cmper(a, b, attr=orderBy, rev=reverse): - a = getattr(a, attr) - b = getattr(b, attr) - if rev: - a, b = b, a + def sortkey(x, attr=orderBy): + a = getattr(x, attr) if a is None: - if b is None: - return 0 - return -1 - if b is None: - return 1 - return cmp(a, b) - return cmper + return Min + return a + results.sort(key=sortkey, reverse=reverse) # This is a one-to-many ----------------------------------------------------------------------- Summary of changes: sqlobject/joins.py | 58 ++++++++++++++++------- sqlobject/tests/test_complex_sorting.py | 77 +++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 18 deletions(-) create mode 100644 sqlobject/tests/test_complex_sorting.py hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-23 16:25:03
|
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 bc89f66a64b910f0cb99a840ce804d458bcdddcc (commit) via 8a6dd908d181b2f3078eb3c40f440d363b0a87b9 (commit) from 2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2 (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/bc89f66a64b910f0cb99a840ce804d458bcdddcc commit bc89f66a64b910f0cb99a840ce804d458bcdddcc Merge: 2f4ecf9 8a6dd90 Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 23 19:23:33 2015 +0300 Merge pull request #95 from drnlm/fix_map_in_select map no longer returns a list on python 3, so explicitly convert it http://sourceforge.net/p/sqlobject/sqlobject/ci/8a6dd908d181b2f3078eb3c40f440d363b0a87b9 commit 8a6dd908d181b2f3078eb3c40f440d363b0a87b9 Author: Neil <drn...@gm...> Date: Mon Feb 23 17:34:30 2015 +0200 map no longer returns a list on python 3, so explicitly convert it diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py index d5ececd..9abfa89 100644 --- a/sqlobject/sresults.py +++ b/sqlobject/sresults.py @@ -22,7 +22,7 @@ class SelectResults(object): ops['orderBy'] = sourceClass.sqlmeta.defaultOrder orderBy = ops['orderBy'] if isinstance(orderBy, (tuple, list)): - orderBy = map(self._mungeOrderBy, orderBy) + orderBy = list(map(self._mungeOrderBy, orderBy)) else: orderBy = self._mungeOrderBy(orderBy) ops['dbOrderBy'] = orderBy ----------------------------------------------------------------------- Summary of changes: sqlobject/sresults.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-23 14:40:02
|
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 2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2 (commit) via 74519a65d4e63b84ccaeefbf151cac7e89eb58d9 (commit) via fcac09d07a7701615ff8c3e11db423ff981a1658 (commit) via 9ac6a41a1e20d0a3f5986a997d312693d8840bee (commit) from 84e6bd0983563d428bc65bc643d6069d62e33cfb (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/2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2 commit 2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2 Merge: 74519a6 fcac09d Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 23 17:35:52 2015 +0300 Merge pull request #93 from drnlm/fix_test_csvexport On python3, zipfile deals in bytes http://sourceforge.net/p/sqlobject/sqlobject/ci/74519a65d4e63b84ccaeefbf151cac7e89eb58d9 commit 74519a65d4e63b84ccaeefbf151cac7e89eb58d9 Merge: 84e6bd0 9ac6a41 Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 23 17:30:42 2015 +0300 Merge pull request #92 from drnlm/fix_test_enum Don't unnecessarily encode enum on python 3 path http://sourceforge.net/p/sqlobject/sqlobject/ci/fcac09d07a7701615ff8c3e11db423ff981a1658 commit fcac09d07a7701615ff8c3e11db423ff981a1658 Author: Neil <drn...@gm...> Date: Mon Feb 23 15:32:16 2015 +0200 On python3, zipfile deals in bytes diff --git a/sqlobject/tests/test_csvexport.py b/sqlobject/tests/test_csvexport.py index 7f97f2d..b062d56 100644 --- a/sqlobject/tests/test_csvexport.py +++ b/sqlobject/tests/test_csvexport.py @@ -96,6 +96,6 @@ def test_zip(): ComplexCSV(fname='Bob', lname='Dylan', age=60) ComplexCSV(fname='Harriet', lname='Tubman', age=160) s = export_csv_zip([SimpleCSV, ComplexCSV]) - assert isinstance(s, str) and s + assert isinstance(s, bytes) and s s = export_csv_zip([SimpleCSV.selectBy(name='Bob'), (ComplexCSV, list(ComplexCSV.selectBy(fname='John')))]) diff --git a/sqlobject/util/csvexport.py b/sqlobject/util/csvexport.py index 5169879..32a7f61 100644 --- a/sqlobject/util/csvexport.py +++ b/sqlobject/util/csvexport.py @@ -3,13 +3,14 @@ Exports a SQLObject class (possibly annotated) to a CSV file. """ import os import csv +import sys try: from cStringIO import StringIO except ImportError: try: from StringIO import StringIO except ImportError: - from io import StringIO + from io import StringIO, BytesIO import sqlobject from sqlobject.compat import string_type @@ -168,7 +169,11 @@ def export_csv_zip(soClasses, file=None, zip=None, filename_prefix='', close_zip_when_finished = False else: return_when_finished = True - file = StringIO() + if sys.version_info[0] < 3: + file = StringIO() + else: + # zipfile on python3 requires BytesIO + file = BytesIO() if not zip: zip = zipfile.ZipFile(file, mode='w') http://sourceforge.net/p/sqlobject/sqlobject/ci/9ac6a41a1e20d0a3f5986a997d312693d8840bee commit 9ac6a41a1e20d0a3f5986a997d312693d8840bee Author: Neil <drn...@gm...> Date: Mon Feb 23 15:28:51 2015 +0200 Don't unnecessarily encode enum on python 3 path diff --git a/sqlobject/col.py b/sqlobject/col.py index d8fdf78..6a4670e 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -1032,7 +1032,9 @@ class EnumValidator(SOValidator): def to_python(self, value, state): if value in self.enumValues: - if isinstance(value, unicode_type): + # Only encode on python 2 - on python 3, the database driver + # will handle this + if isinstance(value, unicode_type) and sys.version_info[0] == 2: dbEncoding = self.getDbEncoding(state) value = value.encode(dbEncoding) return value ----------------------------------------------------------------------- Summary of changes: sqlobject/col.py | 4 +++- sqlobject/tests/test_csvexport.py | 2 +- sqlobject/util/csvexport.py | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-22 15:04:15
|
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 84e6bd0983563d428bc65bc643d6069d62e33cfb (commit) via ee80edccdd188a7cefe466423a898ea302507a9c (commit) via 7e87acfc7e61e371e0a97f307629def620e751cc (commit) via 7a3844c73bd75f08b35305c4817bad134b3e4f8c (commit) from 766863cc2a0cb734ab97eb4320ec8b37bad3518a (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/84e6bd0983563d428bc65bc643d6069d62e33cfb commit 84e6bd0983563d428bc65bc643d6069d62e33cfb Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 22 18:00:57 2015 +0300 Minor update for TODO.txt We now use Github. [skip ci] diff --git a/docs/TODO.txt b/docs/TODO.txt index eabfff6..3556b68 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -89,7 +89,7 @@ TODO * Or move column values access to a separate namespace, e.g. .c: row.c.column. -* More documentation. Wiki. Trac. +* More documentation. * RSS 2.0 and Atom news feeds. http://sourceforge.net/p/sqlobject/sqlobject/ci/ee80edccdd188a7cefe466423a898ea302507a9c commit ee80edccdd188a7cefe466423a898ea302507a9c Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 22 17:58:40 2015 +0300 Minor update for docs Documentation is published at http://sqlobject.readthedocs.org/ in Sphinx format. [skip ci] diff --git a/docs/News.txt b/docs/News.txt index 45996be..36b488e 100644 --- a/docs/News.txt +++ b/docs/News.txt @@ -20,6 +20,12 @@ Development * Source code was made flake8-clean. +Documentation +------------- + +* Documentation is published at http://sqlobject.readthedocs.org/ in + Sphinx format. + SQLObject 2.1.0 =============== diff --git a/docs/TODO.txt b/docs/TODO.txt index 5c3f3f0..eabfff6 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -89,11 +89,6 @@ TODO * Or move column values access to a separate namespace, e.g. .c: row.c.column. -* Convert documentation to Sphinx_ format and publish it on - http://readthedocs.org/ - -.. _Sphinx: http://sphinx.pocoo.org/index.html - * More documentation. Wiki. Trac. * RSS 2.0 and Atom news feeds. http://sourceforge.net/p/sqlobject/sqlobject/ci/7e87acfc7e61e371e0a97f307629def620e751cc commit 7e87acfc7e61e371e0a97f307629def620e751cc Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 22 17:55:11 2015 +0300 Minor update for TODO.txt Using urllib.splituser in _parseURI replaced by urlparse. [skip ci] diff --git a/docs/TODO.txt b/docs/TODO.txt index 6880577..5c3f3f0 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -40,8 +40,6 @@ TODO * Make version_info a namedtuple. -* Stop supporting Python 2.6: restore using urllib.splituser in _parseURI. - * Expression columns - in SELECT but not in INSERT/UPDATE. Something like this:: class MyClass(SQLObject): http://sourceforge.net/p/sqlobject/sqlobject/ci/7a3844c73bd75f08b35305c4817bad134b3e4f8c commit 7a3844c73bd75f08b35305c4817bad134b3e4f8c Author: Oleg Broytman <ph...@ph...> Date: Sun Feb 22 17:53:51 2015 +0300 Minor update for News.txt [skip ci] diff --git a/docs/News.txt b/docs/News.txt index 15d1ffb..45996be 100644 --- a/docs/News.txt +++ b/docs/News.txt @@ -10,8 +10,16 @@ News SQLObject 3.0.0 (master) ======================== +Minor features +-------------- + * PyDispatcher (>=2.0.4) was made an external dependency. +Development +----------- + +* Source code was made flake8-clean. + SQLObject 2.1.0 =============== ----------------------------------------------------------------------- Summary of changes: docs/News.txt | 14 ++++++++++++++ docs/TODO.txt | 9 +-------- 2 files changed, 15 insertions(+), 8 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-21 14:08:57
|
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 766863cc2a0cb734ab97eb4320ec8b37bad3518a (commit) via cbfb77a4415620c83477943dd484fd3783971831 (commit) via cb31910b04cbcde465753d079c0ed825c007b3af (commit) from 8f575d4bd33876da5e9f4f5c913c63f07ed2a312 (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/766863cc2a0cb734ab97eb4320ec8b37bad3518a commit 766863cc2a0cb734ab97eb4320ec8b37bad3518a Merge: 8f575d4 cbfb77a Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 21 17:07:56 2015 +0300 Merge pull request #89 from drnlm/postgres_py3k Postgres py3k http://sourceforge.net/p/sqlobject/sqlobject/ci/cbfb77a4415620c83477943dd484fd3783971831 commit cbfb77a4415620c83477943dd484fd3783971831 Author: Neil <drn...@gm...> Date: Fri Feb 20 17:30:23 2015 +0200 Update postgres ErrorMessage exception diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py index 63afa14..d82d06e 100644 --- a/sqlobject/postgres/pgconnection.py +++ b/sqlobject/postgres/pgconnection.py @@ -8,7 +8,7 @@ from sqlobject.converters import registerConverter class ErrorMessage(str): def __new__(cls, e, append_msg=''): - obj = str.__new__(cls, e[0] + append_msg) + obj = str.__new__(cls, e.args[0] + append_msg) if e.__module__ == 'psycopg2': obj.code = getattr(e, 'pgcode', None) obj.error = getattr(e, 'pgerror', None) http://sourceforge.net/p/sqlobject/sqlobject/ci/cb31910b04cbcde465753d079c0ed825c007b3af commit cb31910b04cbcde465753d079c0ed825c007b3af Author: Neil <drn...@gm...> Date: Fri Feb 20 17:29:45 2015 +0200 Enable postgres testing with python 3 diff --git a/.travis.yml b/.travis.yml index 900ca4f..e78ad92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ env: - TOXENV=py26-sqlite - TOXENV=py27-sqlite - TOXENV=py34-sqlite + - TOXENV=py34-postgres - TOXENV=py27-flake8 - TOXENV=py34-flake8 @@ -17,6 +18,7 @@ matrix: fast_finish: true allow_failures: - env: TOXENV=py34-sqlite + - env: TOXENV=py34-postgres - env: TOXENV=py34-flake8 script: tox -e ${TOXENV} diff --git a/tox.ini b/tox.ini index 46c43bd..b91a30f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.8 -envlist = {py26,py27}-mysql,{py26,py27}-postgres,{py26,py27,py34}-sqlite,{py27,py34}-flake8 +envlist = {py26,py27}-mysql,{py26,py27,py34}-postgres,{py26,py27,py34}-sqlite,{py27,py34}-flake8 # Base test environment settings [testenv] @@ -61,6 +61,12 @@ commands = commands = py.test -D sqlite:///tmp/sqlobject_test.sqdb +[testenv:py34-postgres] +commands = + psql -c 'create database sqlobject_test;' -U postgres + py.test -D postgres://postgres:@localhost/sqlobject_test + psql -c 'drop database sqlobject_test;' -U postgres + [testenv:py27-flake8] basepython = python2.7 deps = ----------------------------------------------------------------------- Summary of changes: .travis.yml | 2 ++ sqlobject/postgres/pgconnection.py | 2 +- tox.ini | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-21 12:35:33
|
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 8f575d4bd33876da5e9f4f5c913c63f07ed2a312 (commit) via 68a58ca651ebe3d32c327f1d3b2d659e9d125d9f (commit) via 1f7dbbf59ba9cf1d408d9a571a0cef60e95cac90 (commit) via c3223bc65a4bf26578527e3f93807a615a597098 (commit) via abb802e6d632eb546785041cba93bba4ef0dd035 (commit) via 55bf16c3f11649919d7013bb20e7b5270d497c6d (commit) from a680896169d936ed7cd366463ba5548f0ed7c10e (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/8f575d4bd33876da5e9f4f5c913c63f07ed2a312 commit 8f575d4bd33876da5e9f4f5c913c63f07ed2a312 Merge: 68a58ca 1f7dbbf Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 21 15:33:48 2015 +0300 Merge pull request #88 from drnlm/dont_encode_python_3 Don't encode strings back to bytes in python 3 http://sourceforge.net/p/sqlobject/sqlobject/ci/68a58ca651ebe3d32c327f1d3b2d659e9d125d9f commit 68a58ca651ebe3d32c327f1d3b2d659e9d125d9f Merge: a680896 c3223bc Author: Oleg Broytman <ph...@ph...> Date: Sat Feb 21 03:42:30 2015 +0300 Merge pull request #87 from drnlm/py3k_fixes_3 Py3k fixes 3 http://sourceforge.net/p/sqlobject/sqlobject/ci/1f7dbbf59ba9cf1d408d9a571a0cef60e95cac90 commit 1f7dbbf59ba9cf1d408d9a571a0cef60e95cac90 Author: Neil <drn...@gm...> Date: Fri Feb 20 17:32:21 2015 +0200 Don't encode strings back to bytes in python 3 diff --git a/sqlobject/col.py b/sqlobject/col.py index b00f2a3..d8fdf78 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -564,7 +564,9 @@ class StringValidator(SOValidator): binaryType = type(None) # Just a simple workaround dbEncoding = self.getDbEncoding(state, default='ascii') if isinstance(value, unicode_type): - return value.encode(dbEncoding) + if sys.version_info[0] < 3: + return value.encode(dbEncoding) + return value if self.dataType and isinstance(value, self.dataType): return value if isinstance(value, http://sourceforge.net/p/sqlobject/sqlobject/ci/c3223bc65a4bf26578527e3f93807a615a597098 commit c3223bc65a4bf26578527e3f93807a615a597098 Author: Neil <drn...@gm...> Date: Fri Feb 20 17:25:42 2015 +0200 Protect against dictionary changes in loop diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index f4d6ff0..ef34be8 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -852,7 +852,7 @@ class Transaction(object): for sub in self.cache.allSubCachesByClassNames().items()] subCaches.extend([(x[0], x[1]) for x in self._deletedCache.items()]) for cls, ids in subCaches: - for id in ids: + for id in list(ids): inst = self._dbConnection.cache.tryGetByName(id, cls) if inst is not None: inst.expire() @@ -869,7 +869,7 @@ class Transaction(object): self._connection.rollback() for subCache, ids in subCaches: - for id in ids: + for id in list(ids): inst = subCache.tryGet(id) if inst is not None: inst.expire() diff --git a/sqlobject/main.py b/sqlobject/main.py index b4884b9..6b793ef 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -127,7 +127,7 @@ def unmakeProperties(obj): delFunc = delattr d = obj.__dict__ - for var, value in d.items(): + for var, value in list(d.items()): if isinstance(value, property): for prop in [value.fget, value.fset, value.fdel]: if prop and prop.__name__ not in d: http://sourceforge.net/p/sqlobject/sqlobject/ci/abb802e6d632eb546785041cba93bba4ef0dd035 commit abb802e6d632eb546785041cba93bba4ef0dd035 Author: Neil <drn...@gm...> Date: Fri Feb 20 17:21:20 2015 +0200 Don't encode logging info on python 3 diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index d6934ea..f4d6ff0 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -40,7 +40,7 @@ class ConsoleWriter: def write(self, text): logfile = getattr(sys, self.loglevel) - if isinstance(text, unicode_type): + if isinstance(text, unicode_type) and sys.version_info[0] < 3: try: text = text.encode(self.dbEncoding) except UnicodeEncodeError: http://sourceforge.net/p/sqlobject/sqlobject/ci/55bf16c3f11649919d7013bb20e7b5270d497c6d commit 55bf16c3f11649919d7013bb20e7b5270d497c6d Author: Neil <drn...@gm...> Date: Fri Feb 20 17:17:07 2015 +0200 Re-add errornously dropped parameter diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 94a3a4a..d6934ea 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -837,7 +837,8 @@ class Transaction(object): meth = types.MethodType(self._dbConnection._SO_delete.__func__, self, self.__class__) else: - meth = types.MethodType(self._dbConnection._SO_delete.__func__) + meth = types.MethodType(self._dbConnection._SO_delete.__func__, + self) return meth(inst) def commit(self, close=False): ----------------------------------------------------------------------- Summary of changes: sqlobject/col.py | 4 +++- sqlobject/dbconnection.py | 9 +++++---- sqlobject/main.py | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-19 15:39:28
|
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 a680896169d936ed7cd366463ba5548f0ed7c10e (commit) via 810594917502d17b338dfe6b5c9f43735a4f8e71 (commit) via e86379aeaa7afddb779b478d23755c373c269347 (commit) via d7c18e4c7ac414b8b4bd4df68351c45f32f21930 (commit) via d7f00741e654cb55713c037e1bcd761e979389be (commit) via 3428200a50dbe2755610be96ed5598563b1b4050 (commit) via 9150a67d2d3681132feb95d037528e96b0fd9c10 (commit) via 724ede91ada4bc064a8014630e0fe570eba85e3d (commit) via d6a56c0e7c4ad322781fa8c2c3fc2e01c81c4afe (commit) via c4f855b7af9d6d710bd2b25cd95ba60ae07ab5eb (commit) via 89e4d26a4076c1dfdd6c031fbc43e34e1edb6e61 (commit) via f86eadf07ba1a8a0234f32e10ba36bcdbb771c2d (commit) via 52fadfa7901af6a739d7bcd2cadacc9e491d1515 (commit) via 58e4f5de7a85f6dd1df6ae42b795838db4c9ec0d (commit) from 1d2c30814029c967ecf0727d87b3c177cbf76375 (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/a680896169d936ed7cd366463ba5548f0ed7c10e commit a680896169d936ed7cd366463ba5548f0ed7c10e Merge: 8105949 e86379a Author: Oleg Broytman <ph...@ph...> Date: Thu Feb 19 18:37:29 2015 +0300 Merge pull request #86 from drnlm/add_compatability_types Add compatability types diff --cc sqlobject/events.py index 5442eac,2ab6b75..bf329df --- a/sqlobject/events.py +++ b/sqlobject/events.py @@@ -328,13 -329,13 +329,13 @@@ def nice_repr(v) """ Like repr(), but nicer for debugging here. """ - if isinstance(v, (types.ClassType, type)): + if isinstance(v, class_types): return v.__module__ + '.' + v.__name__ elif isinstance(v, types.FunctionType): - if '__name__' in v.func_globals: - if getattr(sys.modules[v.func_globals['__name__']], - v.func_name, None) is v: - return '%s.%s' % (v.func_globals['__name__'], v.func_name) + if '__name__' in v.__globals__: + if getattr(sys.modules[v.__globals__['__name__']], + v.__name__, None) is v: + return '%s.%s' % (v.__globals__['__name__'], v.__name__) return repr(v) elif isinstance(v, types.MethodType): return '%s.%s of %s' % ( http://sourceforge.net/p/sqlobject/sqlobject/ci/810594917502d17b338dfe6b5c9f43735a4f8e71 commit 810594917502d17b338dfe6b5c9f43735a4f8e71 Merge: 1d2c308 d6a56c0 Author: Ian Cordasco <sig...@us...> Date: Thu Feb 19 08:27:12 2015 -0600 Merge pull request #85 from drnlm/py3k_fixes_2 More Minor Py3k fixes http://sourceforge.net/p/sqlobject/sqlobject/ci/e86379aeaa7afddb779b478d23755c373c269347 commit e86379aeaa7afddb779b478d23755c373c269347 Author: Neil <drn...@gm...> Date: Thu Feb 19 11:23:59 2015 +0200 Add compability name to avoid buffer related NameErrors diff --git a/sqlobject/col.py b/sqlobject/col.py index 3c06ae4..b00f2a3 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -36,7 +36,7 @@ from .classregistry import findClass from . import constraints as constrs from . import sqlbuilder from .styles import capword -from .compat import string_type, unicode_type +from .compat import string_type, unicode_type, buffer_type import datetime datetime_available = True @@ -568,7 +568,8 @@ class StringValidator(SOValidator): if self.dataType and isinstance(value, self.dataType): return value if isinstance(value, - (str, buffer, binaryType, sqlbuilder.SQLExpression)): + (str, buffer_type, binaryType, + sqlbuilder.SQLExpression)): return value if hasattr(value, '__unicode__'): return unicode(value).encode(dbEncoding) @@ -1668,7 +1669,7 @@ class BinaryValidator(SOValidator): if dbName == "sqlite": value = connection.module.decode(value) return value - if isinstance(value, (buffer, binaryType)): + if isinstance(value, (buffer_type, binaryType)): cachedValue = self._cachedValue if cachedValue and cachedValue[1] == value: return cachedValue[0] diff --git a/sqlobject/compat.py b/sqlobject/compat.py index 8e27aae..e975486 100644 --- a/sqlobject/compat.py +++ b/sqlobject/compat.py @@ -21,7 +21,9 @@ if sys.version_info[0] < 3: string_type = basestring unicode_type = unicode class_types = (type, types.ClassType) + buffer_type = buffer else: string_type = str unicode_type = str class_types = (type, ) + buffer_type = memoryview diff --git a/sqlobject/converters.py b/sqlobject/converters.py index 87879f2..8757e40 100644 --- a/sqlobject/converters.py +++ b/sqlobject/converters.py @@ -3,6 +3,7 @@ import datetime from decimal import Decimal import time import sys +from .compat import buffer_type if sys.version_info[0] < 3: from types import ClassType, InstanceType, NoneType else: @@ -79,7 +80,7 @@ def StringLikeConverter(value, db): value = value.tounicode() except ValueError: value = value.tostring() - elif isinstance(value, buffer): + elif isinstance(value, buffer_type): value = str(value) if db in ('mysql', 'postgres', 'rdbhost'): @@ -98,7 +99,7 @@ if sys.version_info[0] < 3: registerConverter(unicode, StringLikeConverter) registerConverter(array, StringLikeConverter) if sys.version_info[0] < 3: - registerConverter(buffer, StringLikeConverter) + registerConverter(buffer_type, StringLikeConverter) else: registerConverter(memoryview, StringLikeConverter) http://sourceforge.net/p/sqlobject/sqlobject/ci/d7c18e4c7ac414b8b4bd4df68351c45f32f21930 commit d7c18e4c7ac414b8b4bd4df68351c45f32f21930 Author: Neil <drn...@gm...> Date: Wed Feb 18 10:59:43 2015 +0200 Add compatability type for isinstance(x, unicode) checks diff --git a/sqlobject/col.py b/sqlobject/col.py index a86283a..3c06ae4 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -36,7 +36,7 @@ from .classregistry import findClass from . import constraints as constrs from . import sqlbuilder from .styles import capword -from .compat import string_type +from .compat import string_type, unicode_type import datetime datetime_available = True @@ -563,7 +563,7 @@ class StringValidator(SOValidator): except AttributeError: binaryType = type(None) # Just a simple workaround dbEncoding = self.getDbEncoding(state, default='ascii') - if isinstance(value, unicode): + if isinstance(value, unicode_type): return value.encode(dbEncoding) if self.dataType and isinstance(value, self.dataType): return value @@ -592,7 +592,7 @@ class StringCol(Col): class NQuoted(sqlbuilder.SQLExpression): def __init__(self, value): - assert isinstance(value, unicode) + assert isinstance(value, unicode_type) self.value = value def __hash__(self): @@ -608,7 +608,7 @@ class UnicodeStringValidator(SOValidator): def to_python(self, value, state): if value is None: return None - if isinstance(value, (unicode, sqlbuilder.SQLExpression)): + if isinstance(value, (unicode_type, sqlbuilder.SQLExpression)): return value if isinstance(value, str): return unicode(value, self.getDbEncoding(state)) @@ -626,7 +626,7 @@ class UnicodeStringValidator(SOValidator): return None if isinstance(value, (str, sqlbuilder.SQLExpression)): return value - if isinstance(value, unicode): + if isinstance(value, unicode_type): try: connection = state.connection or state.soObject._connection except AttributeError: @@ -1029,7 +1029,7 @@ class EnumValidator(SOValidator): def to_python(self, value, state): if value in self.enumValues: - if isinstance(value, unicode): + if isinstance(value, unicode_type): dbEncoding = self.getDbEncoding(state) value = value.encode(dbEncoding) return value @@ -1738,7 +1738,7 @@ class PickleValidator(BinaryValidator): def to_python(self, value, state): if value is None: return None - if isinstance(value, unicode): + if isinstance(value, unicode_type): dbEncoding = self.getDbEncoding(state, default='ascii') value = value.encode(dbEncoding) if isinstance(value, str): diff --git a/sqlobject/compat.py b/sqlobject/compat.py index aa0288a..8e27aae 100644 --- a/sqlobject/compat.py +++ b/sqlobject/compat.py @@ -19,7 +19,9 @@ def with_metaclass(meta, *bases): # Compatability definitions (inspired by six) if sys.version_info[0] < 3: string_type = basestring + unicode_type = unicode class_types = (type, types.ClassType) else: string_type = str + unicode_type = str class_types = (type, ) diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 956ebc7..fdb6d9e 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -19,7 +19,7 @@ from . import col from .converters import sqlrepr from . import sqlbuilder from .util.threadinglocal import local as threading_local -from .compat import string_type +from .compat import string_type, unicode_type warnings.filterwarnings("ignore", "DB-API extension cursor.lastrowid used") @@ -40,7 +40,7 @@ class ConsoleWriter: def write(self, text): logfile = getattr(sys, self.loglevel) - if isinstance(text, unicode): + if isinstance(text, unicode_type): try: text = text.encode(self.dbEncoding) except UnicodeEncodeError: diff --git a/sqlobject/main.py b/sqlobject/main.py index 5edac41..5c26756 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -41,7 +41,7 @@ from . import declarative from . import events from .sresults import SelectResults from .util.threadinglocal import local -from sqlobject.compat import with_metaclass, string_type +from sqlobject.compat import with_metaclass, string_type, unicode_type if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \ ((sys.version_info[0] == 3) and (sys.version_info[:3] < (3, 4, 0))): @@ -50,7 +50,6 @@ if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \ if sys.version_info[0] > 2: # alias for python 3 compatability long = int - unicode = str """ This thread-local storage is needed for RowCreatedSignals. It gathers @@ -476,7 +475,7 @@ class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)): conn = connection or soClass._connection for columnDef in conn.columnsFromSchema(sqlmeta.table, soClass): if columnDef.name not in sqlmeta.columnDefinitions: - if isinstance(columnDef.name, unicode): + if isinstance(columnDef.name, unicode_type): columnDef.name = columnDef.name.encode('ascii') sqlmeta.addColumn(columnDef) http://sourceforge.net/p/sqlobject/sqlobject/ci/d7f00741e654cb55713c037e1bcd761e979389be commit d7f00741e654cb55713c037e1bcd761e979389be Author: Neil <drn...@gm...> Date: Wed Feb 18 10:56:52 2015 +0200 standardise isinstance test diff --git a/sqlobject/main.py b/sqlobject/main.py index ecae515..5edac41 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -41,7 +41,7 @@ from . import declarative from . import events from .sresults import SelectResults from .util.threadinglocal import local -from sqlobject.compat import with_metaclass +from sqlobject.compat import with_metaclass, string_type if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \ ((sys.version_info[0] == 3) and (sys.version_info[:3] < (3, 4, 0))): @@ -1737,7 +1737,7 @@ class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)): @classmethod def setConnection(cls, value): - if isinstance(value, (str, unicode)): + if isinstance(value, string_type): value = dbconnection.connectionForURI(value) cls._connection = value http://sourceforge.net/p/sqlobject/sqlobject/ci/3428200a50dbe2755610be96ed5598563b1b4050 commit 3428200a50dbe2755610be96ed5598563b1b4050 Author: Neil <drn...@gm...> Date: Wed Feb 18 10:54:48 2015 +0200 replace basestring diff --git a/sqlobject/col.py b/sqlobject/col.py index 8cbf04b..a86283a 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -36,6 +36,7 @@ from .classregistry import findClass from . import constraints as constrs from . import sqlbuilder from .styles import capword +from .compat import string_type import datetime datetime_available = True @@ -1121,7 +1122,7 @@ class SetValidator(SOValidator): self.name, type(value), value), value, state) def from_python(self, value, state): - if isinstance(value, basestring): + if isinstance(value, string_type): value = (value,) try: return ",".join(value) @@ -1532,7 +1533,7 @@ class DecimalValidator(SOValidator): return None if isinstance(value, float): value = str(value) - if isinstance(value, basestring): + if isinstance(value, string_type): try: connection = state.connection or state.soObject._connection except AttributeError: diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 57ca294..956ebc7 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -19,6 +19,7 @@ from . import col from .converters import sqlrepr from . import sqlbuilder from .util.threadinglocal import local as threading_local +from .compat import string_type warnings.filterwarnings("ignore", "DB-API extension cursor.lastrowid used") @@ -618,7 +619,7 @@ class DBAPI(DBConnection): def _SO_selectOneAlt(self, so, columnNames, condition): if columnNames: - columns = [isinstance(x, basestring) and + columns = [isinstance(x, string_type) and sqlbuilder.SQLConstant(x) or x for x in columnNames] else: diff --git a/sqlobject/include/hashcol.py b/sqlobject/include/hashcol.py index 81e5c7a..18aeddf 100644 --- a/sqlobject/include/hashcol.py +++ b/sqlobject/include/hashcol.py @@ -1,4 +1,5 @@ import sqlobject.col +from sqlobject.compat import string_type __all__ = ['HashCol'] @@ -17,7 +18,7 @@ class DbHash: if self.hash is None: return 0 return True - if not isinstance(other, basestring): + if not isinstance(other, string_type): raise TypeError( "A hash may only be compared with a string, or None.") return cmp(self.hashMethod(other), self.hash) diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py index 5795458..a1340d4 100644 --- a/sqlobject/inheritance/__init__.py +++ b/sqlobject/inheritance/__init__.py @@ -7,6 +7,7 @@ from sqlobject import sqlbuilder from sqlobject.col import StringCol, ForeignKey from sqlobject.main import sqlmeta, SQLObject, SelectResults, \ makeProperties, unmakeProperties, getterName, setterName +from sqlobject.compat import string_type from . import iteration @@ -39,7 +40,7 @@ class InheritableSelectResults(SelectResults): if inheritedTables: for tableName in inheritedTables: tablesSet.add(str(tableName)) - if orderBy and not isinstance(orderBy, basestring): + if orderBy and not isinstance(orderBy, string_type): tablesSet.update(tablesUsedSet(orderBy, dbName)) # DSM: if this class has a parent, we need to link it # DSM: and be sure the parent is in the table list. @@ -91,7 +92,7 @@ class InheritableSelectResults(SelectResults): accumulateMany(*attributes) tables = [] for func_name, attribute in attributes: - if not isinstance(attribute, basestring): + if not isinstance(attribute, string_type): tables.append(attribute.tableName) clone = self.__class__(self.sourceClass, self.clause, self.clauseTables, inheritedTables=tables, @@ -456,7 +457,7 @@ class InheritableSQLObject(SQLObject): # if the clause was one of TRUE varians, replace it if (clause is None) or (clause is sqlbuilder.SQLTrueClause) \ or ( - isinstance(clause, basestring) and + isinstance(clause, string_type) and (clause == 'all')): clause = addClause else: diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index 2649985..7b8a9de 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -20,7 +20,7 @@ from sqlobject import col from sqlobject.classregistry import findClass from sqlobject.declarative import DeclarativeMeta from sqlobject.util import moduleloader -from sqlobject.compat import with_metaclass +from sqlobject.compat import with_metaclass, string_type # It's not very unsafe to use tempnam like we are doing: warnings.filterwarnings( @@ -1285,7 +1285,7 @@ class CommandUpgrade(CommandRecord): def update_sys_path(paths, verbose): - if isinstance(paths, basestring): + if isinstance(paths, string_type): paths = [paths] for path in paths: path = os.path.abspath(path) diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py index de028e0..efdcfc2 100644 --- a/sqlobject/sqlbuilder.py +++ b/sqlobject/sqlbuilder.py @@ -70,6 +70,7 @@ import sys from . import classregistry from .converters import registerConverter, sqlrepr, quote_str, unquote_str +from .compat import string_type class VersionError(Exception): @@ -91,7 +92,7 @@ safeSQLRE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_\.]*$') def sqlIdentifier(obj): # some db drivers return unicode column names - return isinstance(obj, basestring) and bool(safeSQLRE.search(obj.strip())) + return isinstance(obj, string_type) and bool(safeSQLRE.search(obj.strip())) def execute(expr, executor): @@ -102,7 +103,7 @@ def execute(expr, executor): def _str_or_sqlrepr(expr, db): - if isinstance(expr, basestring): + if isinstance(expr, string_type): return expr return sqlrepr(expr, db) @@ -721,7 +722,7 @@ class Select(SQLExpression): # None doesn't filter anything, it's just a no-op: return self clause = self.ops['clause'] - if isinstance(clause, basestring): ... 463 lines suppressed ... hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-17 01:23:47
|
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 1d2c30814029c967ecf0727d87b3c177cbf76375 (commit) from 894a92f5b1eda6e2aad174ac34b24971ffdd3008 (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/1d2c30814029c967ecf0727d87b3c177cbf76375 commit 1d2c30814029c967ecf0727d87b3c177cbf76375 Author: Oleg Broytman <ph...@ph...> Date: Tue Feb 17 04:22:31 2015 +0300 Add Lukasz Dobrzanski as a contributor diff --git a/docs/Authors.txt b/docs/Authors.txt index b7755e9..51f7035 100644 --- a/docs/Authors.txt +++ b/docs/Authors.txt @@ -30,6 +30,7 @@ Contributions have been made by: * Andrew Ziem <ahz001 at gmail.com> * Andrew Trusty <atrusty at gatech.edu> * Ian Cordasco <graffatcolmingov at gmail.com> +* Lukasz Dobrzanski <lukasz.m.dobrzanski at gmail.com> * Oleg Broytman <ph...@ph...> .. image:: http://sflogo.sourceforge.net/sflogo.php?group_id=74338&type=10 ----------------------------------------------------------------------- Summary of changes: docs/Authors.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-16 16:34:57
|
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 894a92f5b1eda6e2aad174ac34b24971ffdd3008 (commit) via ff7d207b77a6d9dbab1f7076574b978564dd25c7 (commit) via eb878a622e05d0c703d5433c2ddf18a4799cb680 (commit) via 4414ff1f2b1d142dfb3115b2f3336e2ebe7b4aa9 (commit) via fbd179e40cd4c293a604b7830a320aa8e1af5bf1 (commit) via 7e955f802a8c426894790df3534130b423ef61ba (commit) via aafa59cac20f6686859e11b85cc14eb0213b44f9 (commit) via 056fd5398af45742abee0d419c8687d76c443569 (commit) via c962c5ea401c74343becc23ad0842c3918ec7414 (commit) via 85cc5fe77c7dc412b2a4ed5bc7dcda51ea37cb97 (commit) via 4513d2e88d0527665f6b49ab66ea30a27e7c2040 (commit) via 9e74a80a3abfa69fffae00bea644f2d5b239be00 (commit) via 71df75e74879b273fd861afd39e030d618baeb57 (commit) via d5612ab75b6556f7f041eb31c2541acf649ff7a4 (commit) from fce408b71883cfbafada9c38c3c07328384357ec (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/894a92f5b1eda6e2aad174ac34b24971ffdd3008 commit 894a92f5b1eda6e2aad174ac34b24971ffdd3008 Merge: ff7d207 fbd179e Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 16 19:33:19 2015 +0300 Merge pull request #84 from drnlm/py3k_fixes Py3k fixes http://sourceforge.net/p/sqlobject/sqlobject/ci/ff7d207b77a6d9dbab1f7076574b978564dd25c7 commit ff7d207b77a6d9dbab1f7076574b978564dd25c7 Merge: fce408b eb878a6 Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 16 19:31:18 2015 +0300 Merge pull request #83 from drnlm/fix_lookupConvertor Change lookupConverter to handle python 3 behaviour http://sourceforge.net/p/sqlobject/sqlobject/ci/eb878a622e05d0c703d5433c2ddf18a4799cb680 commit eb878a622e05d0c703d5433c2ddf18a4799cb680 Author: Neil <drn...@gm...> Date: Mon Feb 16 16:47:35 2015 +0200 Expand upon clarifying comment diff --git a/sqlobject/converters.py b/sqlobject/converters.py index 64983fe..87879f2 100644 --- a/sqlobject/converters.py +++ b/sqlobject/converters.py @@ -65,7 +65,7 @@ class ConverterRegistry: else: def lookupConverter(self, value, default=None): # python 3 doesn't have classic classes, so everything's - # in self.klass + # in self.klass due to comparison order in registerConvertor return self.klass.get(value.__class__, default) converters = ConverterRegistry() http://sourceforge.net/p/sqlobject/sqlobject/ci/4414ff1f2b1d142dfb3115b2f3336e2ebe7b4aa9 commit 4414ff1f2b1d142dfb3115b2f3336e2ebe7b4aa9 Author: Neil <drn...@gm...> Date: Mon Feb 16 16:46:42 2015 +0200 Move version check out of lookupConvertor method diff --git a/sqlobject/converters.py b/sqlobject/converters.py index 045f79c..64983fe 100644 --- a/sqlobject/converters.py +++ b/sqlobject/converters.py @@ -56,13 +56,14 @@ class ConverterRegistry: else: self.basic[typ] = func - def lookupConverter(self, value, default=None): - if sys.version_info[0] < 3: + if sys.version_info[0] < 3: + def lookupConverter(self, value, default=None): if type(value) is InstanceType: # lookup on klasses dict return self.klass.get(value.__class__, default) return self.basic.get(type(value), default) - else: + else: + def lookupConverter(self, value, default=None): # python 3 doesn't have classic classes, so everything's # in self.klass return self.klass.get(value.__class__, default) http://sourceforge.net/p/sqlobject/sqlobject/ci/fbd179e40cd4c293a604b7830a320aa8e1af5bf1 commit fbd179e40cd4c293a604b7830a320aa8e1af5bf1 Author: Neil <drn...@gm...> Date: Wed Feb 11 17:47:22 2015 +0200 Use functools.reduce, for python 3 compatibility diff --git a/sqlobject/inheritance/__init__.py b/sqlobject/inheritance/__init__.py index 8d3cf1e..5795458 100644 --- a/sqlobject/inheritance/__init__.py +++ b/sqlobject/inheritance/__init__.py @@ -1,3 +1,5 @@ +from functools import reduce + from sqlobject import dbconnection from sqlobject import classregistry from sqlobject import events http://sourceforge.net/p/sqlobject/sqlobject/ci/7e955f802a8c426894790df3534130b423ef61ba commit 7e955f802a8c426894790df3534130b423ef61ba Author: Neil <drn...@gm...> Date: Wed Feb 11 17:49:19 2015 +0200 Use next builtin diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py index 2e7c775..01878f4 100644 --- a/sqlobject/tests/test_basic.py +++ b/sqlobject/tests/test_basic.py @@ -237,7 +237,7 @@ def testForeignKeyDropTableCascade(): tc6b.destroySelf() assert TestSO5.select().count() == 1 assert TestSO6.select().count() == 0 - assert iter(TestSO5.select()).next() == tc5b + assert next(iter(TestSO5.select())) == tc5b tc6c = TestSO6(name='3') tc5b.other = tc6c assert TestSO5.select().count() == 1 http://sourceforge.net/p/sqlobject/sqlobject/ci/aafa59cac20f6686859e11b85cc14eb0213b44f9 commit aafa59cac20f6686859e11b85cc14eb0213b44f9 Author: Neil <drn...@gm...> Date: Thu Feb 12 17:35:57 2015 +0200 Guard against comparison with None diff --git a/sqlobject/col.py b/sqlobject/col.py index 7c3df4e..8cbf04b 100644 --- a/sqlobject/col.py +++ b/sqlobject/col.py @@ -697,7 +697,7 @@ class SOIntCol(SOCol): if str is None or len(str) < 1: return None - if self.length >= 1: + if self.length and self.length >= 1: _ret = "%s(%d)" % (_ret, self.length) if self.unsigned: _ret = _ret + " UNSIGNED" http://sourceforge.net/p/sqlobject/sqlobject/ci/056fd5398af45742abee0d419c8687d76c443569 commit 056fd5398af45742abee0d419c8687d76c443569 Author: Neil <drn...@gm...> Date: Thu Feb 12 17:59:42 2015 +0200 Use args to get exception details diff --git a/sqlobject/sqlite/sqliteconnection.py b/sqlobject/sqlite/sqliteconnection.py index 1710143..a0c347b 100644 --- a/sqlobject/sqlite/sqliteconnection.py +++ b/sqlobject/sqlite/sqliteconnection.py @@ -18,7 +18,7 @@ sqlite2_Binary = None class ErrorMessage(str): def __new__(cls, e): - obj = str.__new__(cls, e[0]) + obj = str.__new__(cls, e.args[0]) obj.code = None obj.module = e.__module__ obj.exception = e.__class__.__name__ http://sourceforge.net/p/sqlobject/sqlobject/ci/c962c5ea401c74343becc23ad0842c3918ec7414 commit c962c5ea401c74343becc23ad0842c3918ec7414 Author: Neil <drn...@gm...> Date: Thu Feb 12 18:17:12 2015 +0200 Support python 3 iter interface diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 19e14d7..57ca294 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -750,6 +750,9 @@ class Iteration(object): def __iter__(self): return self + def __next__(self): + return self.next() + def next(self): result = self.cursor.fetchone() if result is None: http://sourceforge.net/p/sqlobject/sqlobject/ci/85cc5fe77c7dc412b2a4ed5bc7dcda51ea37cb97 commit 85cc5fe77c7dc412b2a4ed5bc7dcda51ea37cb97 Author: Neil <drn...@gm...> Date: Thu Feb 12 18:09:57 2015 +0200 Ensure we have a list for slice tests in python 3 diff --git a/sqlobject/tests/test_slice.py b/sqlobject/tests/test_slice.py index c612534..5e756e1 100644 --- a/sqlobject/tests/test_slice.py +++ b/sqlobject/tests/test_slice.py @@ -8,6 +8,11 @@ from sqlobject.tests.dbtest import * ######################################## +def listrange(*args): + """Always return a list, for py3k compatibility""" + return list(range(*args)) + + class Counter(SQLObject): number = IntCol(notNull=True) @@ -27,28 +32,28 @@ class TestSlice: def test_slice(self): self.counterEqual( - Counter.select(None, orderBy='number'), range(100)) + Counter.select(None, orderBy='number'), listrange(100)) self.counterEqual( Counter.select(None, orderBy='number')[10:20], - range(10, 20)) + listrange(10, 20)) self.counterEqual( Counter.select(None, orderBy='number')[20:30][:5], - range(20, 25)) + listrange(20, 25)) self.counterEqual( Counter.select(None, orderBy='number')[20:30][1:5], - range(21, 25)) + listrange(21, 25)) self.counterEqual( Counter.select(None, orderBy='number')[:-10], - range(0, 90)) + listrange(0, 90)) self.counterEqual( Counter.select(None, orderBy='number', reversed=True), - range(99, -1, -1)) + listrange(99, -1, -1)) self.counterEqual( Counter.select(None, orderBy='-number'), - range(99, -1, -1)) + listrange(99, -1, -1)) http://sourceforge.net/p/sqlobject/sqlobject/ci/4513d2e88d0527665f6b49ab66ea30a27e7c2040 commit 4513d2e88d0527665f6b49ab66ea30a27e7c2040 Author: Neil <drn...@gm...> Date: Thu Feb 12 18:09:41 2015 +0200 drop xrange diff --git a/sqlobject/cache.py b/sqlobject/cache.py index 111b5a3..ba6361d 100644 --- a/sqlobject/cache.py +++ b/sqlobject/cache.py @@ -195,7 +195,7 @@ class CacheFactory(object): self.expiredCache.pop(key, None) keys = self.cache.keys() - for i in xrange(self.cullOffset, len(keys), self.cullFraction): + for i in range(self.cullOffset, len(keys), self.cullFraction): id = keys[i] # create a weakref, then remove from the cache obj = ref(self.cache[id]) diff --git a/sqlobject/main.py b/sqlobject/main.py index fabd3b4..ecae515 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -1426,7 +1426,7 @@ class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)): cls.__name__, name, repr(value))) else: names = [] - for i in xrange(len(name)): + for i in range(len(name)): names.append("%s = %s" % (name[i], repr(value[i]))) names = ', '.join(names) raise SQLObjectNotFound( http://sourceforge.net/p/sqlobject/sqlobject/ci/9e74a80a3abfa69fffae00bea644f2d5b239be00 commit 9e74a80a3abfa69fffae00bea644f2d5b239be00 Author: Neil <drn...@gm...> Date: Wed Feb 11 17:46:24 2015 +0200 Use codecs.encode for rot13 encoding, to be compatible with python 3 diff --git a/sqlobject/tests/test_basic.py b/sqlobject/tests/test_basic.py index a481708..2e7c775 100644 --- a/sqlobject/tests/test_basic.py +++ b/sqlobject/tests/test_basic.py @@ -1,6 +1,7 @@ import py.test from sqlobject import * from sqlobject.tests.dbtest import * +import codecs class TestSO1(SQLObject): @@ -14,7 +15,7 @@ class TestSO1(SQLObject): cacheValues = False def _set_passwd(self, passwd): - self._SO_set_passwd(passwd.encode('rot13')) + self._SO_set_passwd(codecs.encode(passwd, 'rot13')) def setupGetters(cls): @@ -28,7 +29,7 @@ def test_case1(): setupGetters(TestSO1) bob = TestSO1.selectBy(name='bob')[0] assert bob.name == 'bob' - assert bob.passwd == 'god'.encode('rot13') + assert bob.passwd == codecs.encode('god', 'rot13') bobs = TestSO1.selectBy(name='bob')[:10] assert len(list(bobs)) == 1 @@ -73,14 +74,14 @@ class TestSO2(SQLObject): passwd = StringCol(length=10) def _set_passwd(self, passwd): - self._SO_set_passwd(passwd.encode('rot13')) + self._SO_set_passwd(codecs.encode(passwd, 'rot13')) def test_case2(): setupGetters(TestSO2) bob = TestSO2.selectBy(name='bob')[0] assert bob.name == 'bob' - assert bob.passwd == 'god'.encode('rot13') + assert bob.passwd == codecs.encode('god', 'rot13') class Student(SQLObject): http://sourceforge.net/p/sqlobject/sqlobject/ci/71df75e74879b273fd861afd39e030d618baeb57 commit 71df75e74879b273fd861afd39e030d618baeb57 Author: Neil <drn...@gm...> Date: Fri Feb 13 12:07:57 2015 +0200 python 3 keys don't have a sort method diff --git a/sqlobject/classregistry.py b/sqlobject/classregistry.py index 132afef..07e5abf 100644 --- a/sqlobject/classregistry.py +++ b/sqlobject/classregistry.py @@ -103,8 +103,7 @@ class ClassRegistry(object): try: return self.classes[className] except KeyError: - all = self.classes.keys() - all.sort() + all = sorted(self.classes.keys()) raise KeyError( "No class %s found in the registry %s (these classes " "exist: %s)" diff --git a/sqlobject/inheritance/tests/test_asdict.py b/sqlobject/inheritance/tests/test_asdict.py index 6e37d03..e88ac67 100644 --- a/sqlobject/inheritance/tests/test_asdict.py +++ b/sqlobject/inheritance/tests/test_asdict.py @@ -28,8 +28,7 @@ def test_getColumns(): (InheritablePersonAD, ['firstName', 'lastName']), (ManagerAD, ['department', 'firstName', 'lastName']), (EmployeeAD, ['firstName', 'lastName', 'position'])): - _columns = klass.sqlmeta.getColumns().keys() - _columns.sort() + _columns = sorted(klass.sqlmeta.getColumns().keys()) assert _columns == columns http://sourceforge.net/p/sqlobject/sqlobject/ci/d5612ab75b6556f7f041eb31c2541acf649ff7a4 commit d5612ab75b6556f7f041eb31c2541acf649ff7a4 Author: Neil <drn...@gm...> Date: Thu Feb 12 17:40:01 2015 +0200 Change lookupConverter to handle python 3 behaviour diff --git a/sqlobject/converters.py b/sqlobject/converters.py index 35cfcdc..045f79c 100644 --- a/sqlobject/converters.py +++ b/sqlobject/converters.py @@ -57,10 +57,15 @@ class ConverterRegistry: self.basic[typ] = func def lookupConverter(self, value, default=None): - if type(value) is InstanceType: - # lookup on klasses dict + if sys.version_info[0] < 3: + if type(value) is InstanceType: + # lookup on klasses dict + return self.klass.get(value.__class__, default) + return self.basic.get(type(value), default) + else: + # python 3 doesn't have classic classes, so everything's + # in self.klass return self.klass.get(value.__class__, default) - return self.basic.get(type(value), default) converters = ConverterRegistry() registerConverter = converters.registerConverter ----------------------------------------------------------------------- Summary of changes: sqlobject/cache.py | 2 +- sqlobject/classregistry.py | 3 +-- sqlobject/col.py | 2 +- sqlobject/converters.py | 14 ++++++++++---- sqlobject/dbconnection.py | 3 +++ sqlobject/inheritance/__init__.py | 2 ++ sqlobject/inheritance/tests/test_asdict.py | 3 +-- sqlobject/main.py | 2 +- sqlobject/sqlite/sqliteconnection.py | 2 +- sqlobject/tests/test_basic.py | 11 ++++++----- sqlobject/tests/test_slice.py | 19 ++++++++++++------- 11 files changed, 39 insertions(+), 24 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-15 22:36:43
|
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 fce408b71883cfbafada9c38c3c07328384357ec (commit) via 7d74887a148f8d0ce180bd225fa5cc0b75fddae4 (commit) via a5c1389a31e30ee9f0d545a694d63f3093de14ed (commit) from fb15acc6f07eb639a4dd2be03f080ade895994da (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/fce408b71883cfbafada9c38c3c07328384357ec commit fce408b71883cfbafada9c38c3c07328384357ec Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 16 01:35:47 2015 +0300 Fixed URLs diff --git a/sqlobject/compat.py b/sqlobject/compat.py index 261b364..8828235 100644 --- a/sqlobject/compat.py +++ b/sqlobject/compat.py @@ -1,5 +1,5 @@ -# Credit to six authors http://pypi.python.org/pypi/ -# License http://opensource.org/licenses/MIT +# Credit to six authors: http://pypi.python.org/pypi/six +# License: MIT def with_metaclass(meta, *bases): http://sourceforge.net/p/sqlobject/sqlobject/ci/7d74887a148f8d0ce180bd225fa5cc0b75fddae4 commit 7d74887a148f8d0ce180bd225fa5cc0b75fddae4 Merge: fb15acc a5c1389 Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 16 01:32:25 2015 +0300 Merge pull request #80 from lukmdo/pytest_show_py3_errors make pytest report py3 issues http://sourceforge.net/p/sqlobject/sqlobject/ci/a5c1389a31e30ee9f0d545a694d63f3093de14ed commit a5c1389a31e30ee9f0d545a694d63f3093de14ed Author: Lukasz Dobrzanski <luk...@gm...> Date: Sun Feb 15 02:05:55 2015 +0000 make pytest report py3 issues diff --git a/sqlobject/compat.py b/sqlobject/compat.py new file mode 100644 index 0000000..261b364 --- /dev/null +++ b/sqlobject/compat.py @@ -0,0 +1,14 @@ +# Credit to six authors http://pypi.python.org/pypi/ +# License http://opensource.org/licenses/MIT + + +def with_metaclass(meta, *bases): + """Create a base class with a metaclass.""" + # This requires a bit of explanation: the basic idea is to make a dummy + # metaclass for one level of class instantiation that replaces itself with + # the actual metaclass. + + class metaclass(meta): + def __new__(cls, name, this_bases, d): + return meta(name, bases, d) + return type.__new__(metaclass, 'temporary_class', (), {}) diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py index bc3485a..73373ef 100644 --- a/sqlobject/declarative.py +++ b/sqlobject/declarative.py @@ -34,6 +34,7 @@ or an instance method depending on where it is called. import copy from . import events +from sqlobject.compat import with_metaclass import itertools counter = itertools.count() @@ -90,21 +91,22 @@ class DeclarativeMeta(type): for func in early_funcs: func(cls) if '__classinit__' in new_attrs: - cls.__classinit__ = staticmethod(cls.__classinit__.im_func) + if hasattr(cls.__classinit__, '__func__'): + cls.__classinit__ = staticmethod(cls.__classinit__.__func__) + else: + cls.__classinit__ = staticmethod(cls.__classinit__) cls.__classinit__(cls, new_attrs) for func in post_funcs: func(cls) return cls -class Declarative(object): +class Declarative(with_metaclass(DeclarativeMeta, object)): __unpackargs__ = () __mutableattributes__ = () - __metaclass__ = DeclarativeMeta - __restrict_attributes__ = None def __classinit__(cls, new_attrs): diff --git a/sqlobject/main.py b/sqlobject/main.py index 5812b29..8cdcd22 100644 --- a/sqlobject/main.py +++ b/sqlobject/main.py @@ -25,7 +25,7 @@ License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. """ - +import sys import threading import weakref import types @@ -41,8 +41,8 @@ from . import declarative from . import events from .sresults import SelectResults from .util.threadinglocal import local +from sqlobject.compat import with_metaclass -import sys if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \ ((sys.version_info[0] == 3) and (sys.version_info[:3] < (3, 4, 0))): raise ImportError("SQLObject requires Python 2.6, 2.7 or 3.4+") @@ -50,6 +50,7 @@ if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \ if sys.version_info[0] > 2: # alias for python 3 compatability long = int + unicode = str """ This thread-local storage is needed for RowCreatedSignals. It gathers @@ -180,8 +181,7 @@ class CreateNewSQLObject: pass -class sqlmeta(object): - +class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)): """ This object is the object we use to keep track of all sorts of information. Subclasses are made for each SQLObject subclass @@ -254,8 +254,6 @@ class sqlmeta(object): # Default encoding for UnicodeCol's dbEncoding = None - __metaclass__ = declarative.DeclarativeMeta - def __classinit__(cls, new_attrs): for attr in cls._unshared_attributes: if attr not in new_attrs: @@ -757,9 +755,7 @@ _postponed_local = local() # MetaSQLObject. -class SQLObject(object): - - __metaclass__ = declarative.DeclarativeMeta +class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)): _connection = sqlhub @@ -902,7 +898,7 @@ class SQLObject(object): "(while fixing up sqlmeta %r inheritance)" % cls.sqlmeta) values = dict(cls.sqlmeta.__dict__) - for key in values.keys(): + for key in list(values.keys()): if key.startswith('__') and key.endswith('__'): # Magic values shouldn't be passed through: del values[key] @@ -1355,7 +1351,8 @@ class SQLObject(object): # These are all the column values that were supposed # to be set, but were delayed until now: setters = self._SO_createValues.items() - setters.sort(key=lambda c: self.sqlmeta.columns[c[0]].creationOrder) + setters = sorted( + setters, key=lambda c: self.sqlmeta.columns[c[0]].creationOrder) # Here's their database names: names = [self.sqlmeta.columns[v[0]].dbName for v in setters] values = [v[1] for v in setters] @@ -1734,7 +1731,7 @@ class SQLObject(object): @classmethod def setConnection(cls, value): - if isinstance(value, basestring): + if isinstance(value, (str, unicode)): value = dbconnection.connectionForURI(value) cls._connection = value diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index 214c72d..0cabf56 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -20,6 +20,7 @@ from sqlobject import col from sqlobject.classregistry import findClass from sqlobject.declarative import DeclarativeMeta from sqlobject.util import moduleloader +from sqlobject.compat import with_metaclass # It's not very unsafe to use tempnam like we are doing: warnings.filterwarnings( @@ -179,9 +180,7 @@ def standard_parser(connection=True, simulate=True, return parser -class Command(object): - - __metaclass__ = DeclarativeMeta +class Command(with_metaclass(DeclarativeMeta, object)): min_args = 0 min_args_error = 'You must provide at least %(min_args)s arguments' diff --git a/sqlobject/tests/test_boundattributes.py b/sqlobject/tests/test_boundattributes.py index 1ca9fab..a3c5f8f 100644 --- a/sqlobject/tests/test_boundattributes.py +++ b/sqlobject/tests/test_boundattributes.py @@ -6,9 +6,6 @@ pytestmark = py.test.mark.skipif('True') class TestMe(object): - - # __metaclass__ = declarative.DeclarativeMeta - # __classinit__ = boundattributes.bind_attributes_local pass diff --git a/sqlobject/tests/test_reparent_sqlmeta.py b/sqlobject/tests/test_reparent_sqlmeta.py index 3244ad9..8b61dee 100644 --- a/sqlobject/tests/test_reparent_sqlmeta.py +++ b/sqlobject/tests/test_reparent_sqlmeta.py @@ -19,7 +19,7 @@ class Reparented2(SQLObject): # Well, it's pretty hard to call the superclass method # when it's a classmethod and it's not actually your # *current* superclass. Sigh - real_sqlmeta.setClass.im_func(cls, soClass) + real_sqlmeta.setClass.__func__(cls, soClass) cls.worked = True dummy = StringCol() ----------------------------------------------------------------------- Summary of changes: sqlobject/compat.py | 14 ++++++++++++++ sqlobject/declarative.py | 10 ++++++---- sqlobject/main.py | 21 +++++++++------------ sqlobject/manager/command.py | 5 ++--- sqlobject/tests/test_reparent_sqlmeta.py | 2 +- 5 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 sqlobject/compat.py hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-15 22:24:19
|
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 fb15acc6f07eb639a4dd2be03f080ade895994da (commit) from 3c762203f2dfb80df26876ec06a5ddb3efa11620 (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/fb15acc6f07eb639a4dd2be03f080ade895994da commit fb15acc6f07eb639a4dd2be03f080ade895994da Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 16 01:21:38 2015 +0300 Fix flake8 W503 line break before binary operator diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py index 54b9ac2..19e14d7 100644 --- a/sqlobject/dbconnection.py +++ b/sqlobject/dbconnection.py @@ -618,8 +618,9 @@ class DBAPI(DBConnection): def _SO_selectOneAlt(self, so, columnNames, condition): if columnNames: - columns = [isinstance(x, basestring) and sqlbuilder.SQLConstant(x) - or x for x in columnNames] + columns = [isinstance(x, basestring) and + sqlbuilder.SQLConstant(x) or + x for x in columnNames] else: columns = None return self.queryOne(self.sqlrepr(sqlbuilder.Select( @@ -1040,8 +1041,8 @@ class ConnectionURIOpener(object): def registerConnectionInstance(self, inst): if inst.name: - assert (inst.name not in self.instanceNames - or self.instanceNames[inst.name] is cls # noqa + assert (inst.name not in self.instanceNames or + self.instanceNames[inst.name] is cls # noqa ), ("A instance has already been registered " "with the name %s" % inst.name) assert inst.name.find(':') == -1, \ diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py index bc3485a..9d25445 100644 --- a/sqlobject/declarative.py +++ b/sqlobject/declarative.py @@ -197,8 +197,8 @@ class Declarative(object): @staticmethod def _repr_vars(dictNames): names = [n for n in dictNames - if not n.startswith('_') - and n != 'declarative_count'] + if not n.startswith('_') and + n != 'declarative_count'] names.sort() return names diff --git a/sqlobject/joins.py b/sqlobject/joins.py index 403e4b5..17ae613 100644 --- a/sqlobject/joins.py +++ b/sqlobject/joins.py @@ -420,18 +420,18 @@ class SOManyToMany(object): self.otherClass, events.CreateTableSignal) self.clause = ( (self.otherClass.q.id == - sqlbuilder.Field(self.intermediateTable, self.otherColumn)) - & (sqlbuilder.Field(self.intermediateTable, self.joinColumn) - == self.soClass.q.id)) + sqlbuilder.Field(self.intermediateTable, self.otherColumn)) & + (sqlbuilder.Field(self.intermediateTable, self.joinColumn) == + self.soClass.q.id)) def __get__(self, obj, type): if obj is None: return self query = ( (self.otherClass.q.id == - sqlbuilder.Field(self.intermediateTable, self.otherColumn)) - & (sqlbuilder.Field(self.intermediateTable, self.joinColumn) - == obj.id)) + sqlbuilder.Field(self.intermediateTable, self.otherColumn)) & + (sqlbuilder.Field(self.intermediateTable, self.joinColumn) == + obj.id)) select = self.otherClass.select(query) return _ManyToManySelectWrapper(obj, self, select) @@ -524,15 +524,15 @@ class SOOneToMany(object): self.joinColumn = styles.getStyle( self.soClass).tableReference(self.soClass.sqlmeta.table) self.clause = ( - sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn) - == self.soClass.q.id) + sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn) == + self.soClass.q.id) def __get__(self, obj, type): if obj is None: return self query = ( - sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn) - == obj.id) + sqlbuilder.Field(self.otherClass.sqlmeta.table, self.joinColumn) == + obj.id) select = self.otherClass.select(query) return _OneToManySelectWrapper(obj, self, select) diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py index 52d9363..f0174e4 100755 --- a/sqlobject/manager/command.py +++ b/sqlobject/manager/command.py @@ -440,8 +440,8 @@ class Command(object): for section in p.sections(): name = section.strip().lower() if (conf_section == name or - (conf_section == name.split(':')[-1] - and name.split(':')[0] in ('app', 'application'))): + (conf_section == name.split(':')[-1] and + name.split(':')[0] in ('app', 'application'))): possible_sections.append(section) if not possible_sections: @@ -966,8 +966,7 @@ class CommandRecord(Command): dbName = cls._connection.dbName if cls._connection not in conns: conns.append(cls._connection) - fn = os.path.join(cls.__name__ - + '_' + dbName + '.sql') + fn = os.path.join(cls.__name__ + '_' + dbName + '.sql') if sim: continue create, constraints = cls.createTableSQL() @@ -1058,8 +1057,8 @@ class CommandRecord(Command): print("Cannot edit upgrader because there is no " "previous version") else: - breaker = ('-' * 20 + ' lines below this will be ignored ' - + '-' * 20) + breaker = ('-' * 20 + ' lines below this will be ignored ' + + '-' * 20) pre_text = breaker + '\n' + '\n'.join(all_diffs) text = self.open_editor('\n\n' + pre_text, breaker=breaker, extension='.sql') diff --git a/sqlobject/sresults.py b/sqlobject/sresults.py index fd3e0dd..5660606 100644 --- a/sqlobject/sresults.py +++ b/sqlobject/sresults.py @@ -213,8 +213,8 @@ class SelectResults(object): """ Counting elements of current select results """ assert not self.ops.get('start') and not self.ops.get('end'), \ "start/end/limit have no meaning with 'count'" - assert not (self.ops.get('distinct') and (self.ops.get('start') - or self.ops.get('end'))), \ + assert not (self.ops.get('distinct') and + (self.ops.get('start') or self.ops.get('end'))), \ "distinct-counting of sliced objects is not supported" if self.ops.get('distinct'): # Column must be specified, so we are using unique ID column. diff --git a/sqlobject/tests/test_auto.py b/sqlobject/tests/test_auto.py index a00f8fb..c6d5fec 100644 --- a/sqlobject/tests/test_auto.py +++ b/sqlobject/tests/test_auto.py @@ -47,8 +47,8 @@ class TestPeople: nickname = StringCol('nickname', length=10) Person.sqlmeta.addColumn(nickname, changeSchema=True) Person(name='robert', nickname='bob') - assert ([p.name for p in Person.select('all')] - == ['bob', 'jake', 'jane', 'robert', 'tim']) + assert ([p.name for p in Person.select('all')] == + ['bob', 'jake', 'jane', 'robert', 'tim']) Person.sqlmeta.delColumn(nickname, changeSchema=True) def test_dynamicJoin(self): diff --git a/sqlobject/tests/test_joins.py b/sqlobject/tests/test_joins.py index 63fa306..c570b2f 100644 --- a/sqlobject/tests/test_joins.py +++ b/sqlobject/tests/test_joins.py @@ -110,8 +110,8 @@ class TestJoin2: def test_defaultOrder(self): p1 = PersonJoiner2.byName('bob') - assert ([i.zip for i in p1.addressJoiner2s] - == ['33333', '22222', '11111']) + assert ([i.zip for i in p1.addressJoiner2s] == + ['33333', '22222', '11111']) _personJoiner3_getters = [] diff --git a/sqlobject/tests/test_new_joins.py b/sqlobject/tests/test_new_joins.py index 10f108d..c325eb7 100644 --- a/sqlobject/tests/test_new_joins.py +++ b/sqlobject/tests/test_new_joins.py @@ -116,8 +116,8 @@ class TestJoin2: def test_defaultOrder(self): p1 = PersonJoinerNew2.byName('bob') - assert ([i.zip for i in p1.addressJoiner2s] - == ['33333', '22222', '11111']) + assert ([i.zip for i in p1.addressJoiner2s] == + ['33333', '22222', '11111']) _personJoiner3_getters = [] diff --git a/sqlobject/tests/test_transactions.py b/sqlobject/tests/test_transactions.py index 171d5ee..124ff8b 100644 --- a/sqlobject/tests/test_transactions.py +++ b/sqlobject/tests/test_transactions.py @@ -26,8 +26,8 @@ def test_transaction(): TestSOTrans(name='joe', connection=trans) trans.rollback() trans.begin() - assert ([n.name for n in TestSOTrans.select(connection=trans)] - == ['bob', 'tim']) + assert ([n.name for n in TestSOTrans.select(connection=trans)] == + ['bob', 'tim']) b = TestSOTrans.byName('bob', connection=trans) b.name = 'robert' trans.commit() diff --git a/sqlobject/util/csvimport.py b/sqlobject/util/csvimport.py index 79ef985..ba0fa0d 100644 --- a/sqlobject/util/csvimport.py +++ b/sqlobject/util/csvimport.py @@ -88,8 +88,8 @@ def create_data(data, class_getter, keyorder=None): """ objects = {} classnames = data.keys() - if (not keyorder and isinstance(class_getter, types.ModuleType) - and hasattr(class_getter, 'soClasses')): + if (not keyorder and isinstance(class_getter, types.ModuleType) and + hasattr(class_getter, 'soClasses')): keyorder = [c.__name__ for c in class_getter.soClasses] if not keyorder: classnames.sort() @@ -117,8 +117,7 @@ def create_data(data, class_getter, keyorder=None): raise ValueError( "Object reference to %r does not have target" % value.name) - elif (isinstance(resolved, list) - and len(resolved) > 1): + elif (isinstance(resolved, list) and len(resolved) > 1): raise ValueError( "Object reference to %r is ambiguous (got %r)" % (value.name, resolved)) ----------------------------------------------------------------------- Summary of changes: sqlobject/dbconnection.py | 9 +++++---- sqlobject/declarative.py | 4 ++-- sqlobject/joins.py | 20 ++++++++++---------- sqlobject/manager/command.py | 11 +++++------ sqlobject/sresults.py | 4 ++-- sqlobject/tests/test_auto.py | 4 ++-- sqlobject/tests/test_joins.py | 4 ++-- sqlobject/tests/test_new_joins.py | 4 ++-- sqlobject/tests/test_transactions.py | 4 ++-- sqlobject/util/csvimport.py | 7 +++---- 10 files changed, 35 insertions(+), 36 deletions(-) hooks/post-receive -- SQLObject development repository |
From: Oleg B. <no...@so...> - 2015-02-15 22:10:53
|
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 3c762203f2dfb80df26876ec06a5ddb3efa11620 (commit) from 430a2fe7344f2a4a9e9741c96abfb77fc7cfe5a3 (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/3c762203f2dfb80df26876ec06a5ddb3efa11620 commit 3c762203f2dfb80df26876ec06a5ddb3efa11620 Author: Oleg Broytman <ph...@ph...> Date: Mon Feb 16 01:09:41 2015 +0300 Require sources to be flake8-clean at least for py2.7 diff --git a/.travis.yml b/.travis.yml index 6cf7e62..900ca4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ matrix: fast_finish: true allow_failures: - env: TOXENV=py34-sqlite - - env: TOXENV=py27-flake8 - env: TOXENV=py34-flake8 script: tox -e ${TOXENV} diff --git a/docs/DeveloperGuide.txt b/docs/DeveloperGuide.txt index 0182c99..d788d50 100644 --- a/docs/DeveloperGuide.txt +++ b/docs/DeveloperGuide.txt @@ -39,6 +39,12 @@ Python Style Guide. Some things to take particular note of: .. _PEP 8: http://www.python.org/peps/pep-0008.html +* With a few exceptions sources must be `flake8`_-clean (and hence + pep8-clean). Please consider using pre-commit hook installed by + running ``flake8 --install-hook``. + +.. _flake8: https://gitlab.com/pycqa/flake8 + * **No tabs**. Not anywhere. Always indent with 4 spaces. * I don't stress too much on line length. But try to break lines up ----------------------------------------------------------------------- Summary of changes: .travis.yml | 1 - docs/DeveloperGuide.txt | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletions(-) hooks/post-receive -- SQLObject development repository |