sqlobject-cvs Mailing List for SQLObject (Page 46)
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
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
|
From: <sub...@co...> - 2010-07-30 10:08:08
|
Author: phd
Date: 2010-07-30 03:40:44 -0600 (Fri, 30 Jul 2010)
New Revision: 4222
Modified:
SQLObject/branches/0.13/docs/News.txt
SQLObject/branches/0.13/sqlobject/col.py
Log:
Removed SQLValidator - its attemptConvert was never called
because in FormEncode it's named attempt_convert.
Modified: SQLObject/branches/0.13/docs/News.txt
===================================================================
--- SQLObject/branches/0.13/docs/News.txt 2010-07-28 03:25:46 UTC (rev 4221)
+++ SQLObject/branches/0.13/docs/News.txt 2010-07-30 09:40:44 UTC (rev 4222)
@@ -44,6 +44,9 @@
* A new parameter 'sslmode' was added to PostgresConnection.
+* Removed SQLValidator - its attemptConvert was never called because in
+ FormEncode it's named attempt_convert.
+
SQLObject 0.12.5
================
Modified: SQLObject/branches/0.13/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/col.py 2010-07-28 03:25:46 UTC (rev 4221)
+++ SQLObject/branches/0.13/sqlobject/col.py 2010-07-30 09:40:44 UTC (rev 4222)
@@ -72,20 +72,6 @@
creationOrder = count()
-class SQLValidator(compound.All):
- def attemptConvert(self, value, state, validate):
- if validate is validators.to_python:
- vlist = list(self.validators[:])
- vlist.reverse()
- elif validate is validators.from_python:
- vlist = self.validators
- else:
- raise RuntimeError
- for validator in vlist:
- value = validate(validator, value, state)
- return value
-
-
########################################
## Columns
########################################
@@ -209,7 +195,7 @@
_validators = self.createValidators()
if _validators:
if validator: _validators.append(validator)
- self.validator = SQLValidator.join(_validators[0], *_validators[1:])
+ self.validator = compound.All.join(_validators[0], *_validators[1:])
else:
self.validator = validator
self.noCache = noCache
|
|
From: <sub...@co...> - 2010-07-15 15:54:09
|
Author: phd Date: 2010-07-15 09:54:02 -0600 (Thu, 15 Jul 2010) New Revision: 4218 Added: SQLObject/tags/0.13.0b1/ Log: Tagging 0.13.0b1 Copied: SQLObject/tags/0.13.0b1 (from rev 4217, SQLObject/branches/0.13) |
|
From: <sub...@co...> - 2010-07-15 15:50:55
|
Author: phd Date: 2010-07-15 09:50:49 -0600 (Thu, 15 Jul 2010) New Revision: 4217 Modified: SQLObject/trunk/docs/News.txt Log: Restart the trunk news. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-07-15 15:48:50 UTC (rev 4216) +++ SQLObject/trunk/docs/News.txt 2010-07-15 15:50:49 UTC (rev 4217) @@ -10,6 +10,9 @@ SQLObject (trunk) ================= +SQLObject 0.13.0 +================ + Features & Interface -------------------- |
|
From: <sub...@co...> - 2010-07-15 15:48:56
|
Author: phd Date: 2010-07-15 09:48:50 -0600 (Thu, 15 Jul 2010) New Revision: 4216 Modified: SQLObject/branches/0.13/docs/News.txt Log: This will be version SQLObject 0.13.0. Modified: SQLObject/branches/0.13/docs/News.txt =================================================================== --- SQLObject/branches/0.13/docs/News.txt 2010-07-15 15:47:58 UTC (rev 4215) +++ SQLObject/branches/0.13/docs/News.txt 2010-07-15 15:48:50 UTC (rev 4216) @@ -7,8 +7,8 @@ .. _start: -SQLObject (trunk) -================= +SQLObject 0.13.0 +================ Features & Interface -------------------- |
|
From: <sub...@co...> - 2010-07-15 15:48:04
|
Author: phd
Date: 2010-07-15 09:47:58 -0600 (Thu, 15 Jul 2010)
New Revision: 4215
Modified:
SQLObject/trunk/setup.py
SQLObject/trunk/sqlobject/__init__.py
SQLObject/trunk/sqlobject/main.py
Log:
The trunk will be version 0.14.
Modified: SQLObject/trunk/setup.py
===================================================================
--- SQLObject/trunk/setup.py 2010-07-15 15:46:45 UTC (rev 4214)
+++ SQLObject/trunk/setup.py 2010-07-15 15:47:58 UTC (rev 4215)
@@ -21,7 +21,7 @@
"""
setup(name="SQLObject",
- version="0.13",
+ version="0.14",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
@@ -35,7 +35,7 @@
Supports MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (SAPDB).
For development see the `subversion repository
-<http://svn.colorstudy.com/SQLObject/trunk#egg=SQLObject-0.13dev>`_
+<http://svn.colorstudy.com/SQLObject/trunk#egg=SQLObject-0.14dev>`_
""",
classifiers=[
"Development Status :: 5 - Production/Stable",
Modified: SQLObject/trunk/sqlobject/__init__.py
===================================================================
--- SQLObject/trunk/sqlobject/__init__.py 2010-07-15 15:46:45 UTC (rev 4214)
+++ SQLObject/trunk/sqlobject/__init__.py 2010-07-15 15:47:58 UTC (rev 4215)
@@ -1,5 +1,5 @@
"""
-SQLObject 0.13
+SQLObject 0.14
"""
from col import *
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-07-15 15:46:45 UTC (rev 4214)
+++ SQLObject/trunk/sqlobject/main.py 2010-07-15 15:47:58 UTC (rev 4215)
@@ -1,5 +1,5 @@
"""
-SQLObject 0.13
+SQLObject 0.14
--------------
:author: Ian Bicking <ia...@co...>
|
|
From: <sub...@co...> - 2010-07-15 15:46:51
|
Author: phd Date: 2010-07-15 09:46:45 -0600 (Thu, 15 Jul 2010) New Revision: 4214 Modified: SQLObject/branches/0.13/setup.py Log: Branch 0.13. Modified: SQLObject/branches/0.13/setup.py =================================================================== --- SQLObject/branches/0.13/setup.py 2010-07-15 15:44:49 UTC (rev 4213) +++ SQLObject/branches/0.13/setup.py 2010-07-15 15:46:45 UTC (rev 4214) @@ -35,7 +35,7 @@ Supports MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (SAPDB). For development see the `subversion repository -<http://svn.colorstudy.com/SQLObject/trunk#egg=SQLObject-0.13dev>`_ +<http://svn.colorstudy.com/SQLObject/branches/0.13>`_ """, classifiers=[ "Development Status :: 5 - Production/Stable", @@ -49,7 +49,7 @@ author="Ian Bicking", author_email="ia...@co...", url="http://sqlobject.org/devel/", - download_url="http://cheeseshop.python.org/pypi/SQLObject/", + download_url="http://cheeseshop.python.org/pypi/SQLObject/0.13", license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], |
|
From: <sub...@co...> - 2010-07-15 15:44:56
|
Author: phd Date: 2010-07-15 09:44:49 -0600 (Thu, 15 Jul 2010) New Revision: 4213 Added: SQLObject/branches/0.13/ Log: Branch 0.13 Copied: SQLObject/branches/0.13 (from rev 4212, SQLObject/trunk) |
|
From: <sub...@co...> - 2010-07-15 15:34:27
|
Author: phd Date: 2010-07-15 09:34:19 -0600 (Thu, 15 Jul 2010) New Revision: 4212 Modified: SQLObject/branches/0.12/setup.py Log: Branch 0.12. Modified: SQLObject/branches/0.12/setup.py =================================================================== --- SQLObject/branches/0.12/setup.py 2010-07-15 15:32:34 UTC (rev 4211) +++ SQLObject/branches/0.12/setup.py 2010-07-15 15:34:19 UTC (rev 4212) @@ -35,7 +35,7 @@ Supports MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (SAPDB). For development see the `subversion repository -<http://svn.colorstudy.com/SQLObject/trunk#egg=SQLObject-0.12>`_ +<http://svn.colorstudy.com/SQLObject/branches/0.12>`_ """, classifiers=[ "Development Status :: 5 - Production/Stable", |
|
From: <sub...@co...> - 2010-07-15 15:32:40
|
Author: phd Date: 2010-07-15 09:32:34 -0600 (Thu, 15 Jul 2010) New Revision: 4211 Added: SQLObject/tags/0.12.5b1/ Log: Tagging 0.12.5b1 Copied: SQLObject/tags/0.12.5b1 (from rev 4210, SQLObject/branches/0.12) |
|
From: <sub...@co...> - 2010-07-15 15:13:29
|
Author: phd Date: 2010-07-15 09:13:23 -0600 (Thu, 15 Jul 2010) New Revision: 4210 Modified: SQLObject/trunk/docs/SQLObject.txt Log: Merged revision 4209 from branch 0.11: 'backend' parameter was renamed to 'driver'. Modified: SQLObject/trunk/docs/SQLObject.txt =================================================================== --- SQLObject/trunk/docs/SQLObject.txt 2010-07-15 15:12:13 UTC (rev 4209) +++ SQLObject/trunk/docs/SQLObject.txt 2010-07-15 15:13:23 UTC (rev 4210) @@ -1733,9 +1733,9 @@ PostgresConnection supports transactions and all other features. -The user can choose a DB API driver for PostgreSQL by using a "backend" +The user can choose a DB API driver for PostgreSQL by using a "driver" parameter in DB URI or PostgresConnection that can be a comma-separated -list of backend names. Possible backends are: "psycopg2", "psycopg1", +list of driver names. Possible drivers are: "psycopg2", "psycopg1", "psycopg" (tries psycopg2 and psycopg1), "pygresql". Default is "psycopg". SQLite @@ -1752,9 +1752,9 @@ SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. -The user can choose a DB API driver for SQLite by using a "backend" +The user can choose a DB API driver for SQLite by using a "driver" parameter in DB URI or SQLiteConnection that can be a comma-separated list -of backend names. Possible backends are: "pysqlite2" (alias "sqlite2"), +of driver names. Possible drivers are: "pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). Default is to test pysqlite2, sqlite3 and sqlite in that order. @@ -1846,9 +1846,9 @@ .. _pymssql: http://pymssql.sourceforge.net/ .. _adodbapi: http://adodbapi.sourceforge.net/ -The user can choose a DB API driver for MSSQL by using a "backend" +The user can choose a DB API driver for MSSQL by using a "driver" parameter in DB URI or MSSQLConnection that can be a comma-separated list -of backend names. Possible backends are: "adodb" (alias "adodbapi") and +of driver names. Possible drivers are: "adodb" (alias "adodbapi") and "pymssql". Default is to test adodbapi and pymssql in that order. Events (signals) |
|
From: <sub...@co...> - 2010-07-15 15:12:19
|
Author: phd Date: 2010-07-15 09:12:13 -0600 (Thu, 15 Jul 2010) New Revision: 4209 Modified: SQLObject/branches/0.12/docs/SQLObject.txt Log: 'backend' parameter was renamed to 'driver'. Modified: SQLObject/branches/0.12/docs/SQLObject.txt =================================================================== --- SQLObject/branches/0.12/docs/SQLObject.txt 2010-07-15 14:58:43 UTC (rev 4208) +++ SQLObject/branches/0.12/docs/SQLObject.txt 2010-07-15 15:12:13 UTC (rev 4209) @@ -1733,9 +1733,9 @@ PostgresConnection supports transactions and all other features. -The user can choose a DB API driver for PostgreSQL by using a "backend" +The user can choose a DB API driver for PostgreSQL by using a "driver" parameter in DB URI or PostgresConnection that can be a comma-separated -list of backend names. Possible backends are: "psycopg2", "psycopg1", +list of driver names. Possible drivers are: "psycopg2", "psycopg1", "psycopg" (tries psycopg2 and psycopg1), "pygresql". Default is "psycopg". SQLite @@ -1752,9 +1752,9 @@ SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. -The user can choose a DB API driver for SQLite by using a "backend" +The user can choose a DB API driver for SQLite by using a "driver" parameter in DB URI or SQLiteConnection that can be a comma-separated list -of backend names. Possible backends are: "pysqlite2" (alias "sqlite2"), +of driver names. Possible drivers are: "pysqlite2" (alias "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). Default is to test pysqlite2, sqlite3 and sqlite in that order. @@ -1846,9 +1846,9 @@ .. _pymssql: http://pymssql.sourceforge.net/ .. _adodbapi: http://adodbapi.sourceforge.net/ -The user can choose a DB API driver for MSSQL by using a "backend" +The user can choose a DB API driver for MSSQL by using a "driver" parameter in DB URI or MSSQLConnection that can be a comma-separated list -of backend names. Possible backends are: "adodb" (alias "adodbapi") and +of driver names. Possible drivers are: "adodb" (alias "adodbapi") and "pymssql". Default is to test adodbapi and pymssql in that order. Events (signals) |
|
From: <sub...@co...> - 2010-07-15 14:58:51
|
Author: phd
Date: 2010-07-15 08:58:43 -0600 (Thu, 15 Jul 2010)
New Revision: 4208
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
SQLObject/trunk/sqlobject/postgres/pgconnection.py
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Log:
Merged revision 4207 from branch 0.12: 'backend' parameter was renamed to 'driver'.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-07-15 14:56:25 UTC (rev 4207)
+++ SQLObject/trunk/docs/News.txt 2010-07-15 14:58:43 UTC (rev 4208)
@@ -44,6 +44,12 @@
* A new parameter 'sslmode' was added to PostgresConnection.
+SQLObject 0.12.5
+================
+
+* 'backend' parameter was renamed to 'driver'. To preserve backward
+ compatibility 'backend' is recognized and will be recognized for some time.
+
SQLObject 0.12.4
================
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2010-07-15 14:56:25 UTC (rev 4207)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2010-07-15 14:58:43 UTC (rev 4208)
@@ -10,24 +10,25 @@
def __init__(self, db, user, password='', host='localhost',
autoCommit=0, **kw):
- backends = kw.pop('backend', None) or 'adodb,pymssql'
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ drivers = kw.pop('driver', None) or \
+ kw.pop('backend', None) or 'adodb,pymssql'
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend in ('adodb', 'adodbapi'):
+ if driver in ('adodb', 'adodbapi'):
import adodbapi as sqlmodule
- elif backend == 'pymssql':
+ elif driver == 'pymssql':
import pymssql as sqlmodule
else:
- raise ValueError('Unknown MSSQL backend "%s", expected adodb or pymssql' % backend)
+ raise ValueError('Unknown MSSQL driver "%s", expected adodb or pymssql' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find an MSSQL backend, tried %s' % backends)
+ raise ImportError('Cannot find an MSSQL driver, tried %s' % drivers)
self.module = sqlmodule
if sqlmodule.__name__ == 'adodbapi':
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py 2010-07-15 14:56:25 UTC (rev 4207)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py 2010-07-15 14:58:43 UTC (rev 4208)
@@ -11,34 +11,35 @@
schemes = [dbName, 'postgresql']
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, backend='psycopg', **kw):
- backends = backend
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ user=None, password=None, **kw):
+ drivers = kw.pop('driver', None) or \
+ kw.pop('backend', None) or 'psycopg'
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend == 'psycopg2':
+ if driver == 'psycopg2':
import psycopg2 as psycopg
- elif backend == 'psycopg1':
+ elif driver == 'psycopg1':
import psycopg
- elif backend == 'psycopg':
+ elif driver == 'psycopg':
try:
import psycopg2 as psycopg
except ImportError:
import psycopg
- elif backend == 'pygresql':
+ elif driver == 'pygresql':
import pgdb
self.module = pgdb
else:
- raise ValueError('Unknown PostgreSQL backend "%s", expected psycopg2, psycopg1 or pygresql' % backend)
+ raise ValueError('Unknown PostgreSQL driver "%s", expected psycopg2, psycopg1 or pygresql' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find a PostgreSQL backend, tried %s' % backends)
- if backend.startswith('psycopg'):
+ raise ImportError('Cannot find a PostgreSQL driver, tried %s' % drivers)
+ if driver.startswith('psycopg'):
self.module = psycopg
# Register a converter for psycopg Binary type.
registerConverter(type(psycopg.Binary('')),
@@ -53,7 +54,7 @@
if host:
dsn_dict["host"] = host
if port:
- if backend == 'pygresql':
+ if driver == 'pygresql':
dsn_dict["host"] = "%s:%d" % (host, port)
else:
if psycopg.__version__.split('.')[0] == '1':
@@ -71,7 +72,7 @@
dsn_dict["sslmode"] = sslmode
self.use_dsn = dsn is not None
if dsn is None:
- if backend == 'pygresql':
+ if driver == 'pygresql':
dsn = ''
if host:
dsn += host
@@ -99,6 +100,7 @@
if sslmode:
dsn.append('sslmode=%s' % sslmode)
dsn = ' '.join(dsn)
+ self.driver = driver
self.dsn = dsn
self.unicodeCols = kw.pop('unicodeCols', False)
self.schema = kw.pop('schema', None)
@@ -326,7 +328,7 @@
# We have to connect to *some* database, so we'll connect to
# template1, which is a common open database.
# @@: This doesn't use self.use_dsn or self.dsn_dict
- if self.backend == 'pygresql':
+ if self.driver == 'pygresql':
dsn = '%s:template1:%s:%s' % (
self.host or '', self.user or '', self.password or '')
else:
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2010-07-15 14:56:25 UTC (rev 4207)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2010-07-15 14:58:43 UTC (rev 4208)
@@ -22,29 +22,30 @@
schemes = [dbName]
def __init__(self, filename, autoCommit=1, **kw):
- backends = kw.pop('backend', None) or 'pysqlite2,sqlite3,sqlite'
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ drivers = kw.pop('driver', None) or \
+ kw.pop('backend', None) or 'pysqlite2,sqlite3,sqlite'
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend in ('sqlite2', 'pysqlite2'):
+ if driver in ('sqlite2', 'pysqlite2'):
from pysqlite2 import dbapi2 as sqlite
self.using_sqlite2 = True
- elif backend == 'sqlite3':
+ elif driver == 'sqlite3':
import sqlite3 as sqlite
self.using_sqlite2 = True
- elif backend in ('sqlite', 'sqlite1'):
+ elif driver in ('sqlite', 'sqlite1'):
import sqlite
self.using_sqlite2 = False
else:
- raise ValueError('Unknown SQLite backend "%s", expected pysqlite2, sqlite3 or sqlite' % backend)
+ raise ValueError('Unknown SQLite driver "%s", expected pysqlite2, sqlite3 or sqlite' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find an SQLite backend, tried %s' % backends)
+ raise ImportError('Cannot find an SQLite driver, tried %s' % drivers)
if self.using_sqlite2:
sqlite.encode = base64.encodestring
sqlite.decode = base64.decodestring
|
|
From: <sub...@co...> - 2010-07-15 14:56:32
|
Author: phd
Date: 2010-07-15 08:56:25 -0600 (Thu, 15 Jul 2010)
New Revision: 4207
Modified:
SQLObject/branches/0.12/docs/News.txt
SQLObject/branches/0.12/sqlobject/mssql/mssqlconnection.py
SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py
SQLObject/branches/0.12/sqlobject/sqlite/sqliteconnection.py
Log:
'backend' parameter was renamed to 'driver'.
To preserve backward compatibility 'backend' is recognized.
Modified: SQLObject/branches/0.12/docs/News.txt
===================================================================
--- SQLObject/branches/0.12/docs/News.txt 2010-07-12 19:45:19 UTC (rev 4206)
+++ SQLObject/branches/0.12/docs/News.txt 2010-07-15 14:56:25 UTC (rev 4207)
@@ -7,6 +7,12 @@
.. _start:
+SQLObject 0.12.5
+================
+
+* 'backend' parameter was renamed to 'driver'. To preserve backward
+ compatibility 'backend' is recognized and will be recognized for some time.
+
SQLObject 0.12.4
================
Modified: SQLObject/branches/0.12/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/mssql/mssqlconnection.py 2010-07-12 19:45:19 UTC (rev 4206)
+++ SQLObject/branches/0.12/sqlobject/mssql/mssqlconnection.py 2010-07-15 14:56:25 UTC (rev 4207)
@@ -10,24 +10,25 @@
def __init__(self, db, user, password='', host='localhost',
autoCommit=0, **kw):
- backends = kw.pop('backend', None) or 'adodb,pymssql'
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ drivers = kw.pop('driver', None) or \
+ kw.pop('backend', None) or 'adodb,pymssql'
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend in ('adodb', 'adodbapi'):
+ if driver in ('adodb', 'adodbapi'):
import adodbapi as sqlmodule
- elif backend == 'pymssql':
+ elif driver == 'pymssql':
import pymssql as sqlmodule
else:
- raise ValueError('Unknown MSSQL backend "%s", expected adodb or pymssql' % backend)
+ raise ValueError('Unknown MSSQL driver "%s", expected adodb or pymssql' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find an MSSQL backend, tried %s' % backends)
+ raise ImportError('Cannot find an MSSQL driver, tried %s' % drivers)
self.module = sqlmodule
if sqlmodule.__name__ == 'adodbapi':
Modified: SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py 2010-07-12 19:45:19 UTC (rev 4206)
+++ SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py 2010-07-15 14:56:25 UTC (rev 4207)
@@ -11,34 +11,35 @@
schemes = [dbName, 'postgresql']
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, backend='psycopg', **kw):
- backends = backend
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ user=None, password=None, **kw):
+ drivers = kw.pop('driver', None) or \
+ kw.pop('backend', None) or 'psycopg'
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend == 'psycopg2':
+ if driver == 'psycopg2':
import psycopg2 as psycopg
- elif backend == 'psycopg1':
+ elif driver == 'psycopg1':
import psycopg
- elif backend == 'psycopg':
+ elif driver == 'psycopg':
try:
import psycopg2 as psycopg
except ImportError:
import psycopg
- elif backend == 'pygresql':
+ elif driver == 'pygresql':
import pgdb
self.module = pgdb
else:
- raise ValueError('Unknown PostgreSQL backend "%s", expected psycopg2, psycopg1 or pygresql' % backend)
+ raise ValueError('Unknown PostgreSQL driver "%s", expected psycopg2, psycopg1 or pygresql' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find a PostgreSQL backend, tried %s' % backends)
- if backend.startswith('psycopg'):
+ raise ImportError('Cannot find a PostgreSQL driver, tried %s' % drivers)
+ if driver.startswith('psycopg'):
self.module = psycopg
# Register a converter for psycopg Binary type.
registerConverter(type(psycopg.Binary('')),
@@ -53,7 +54,7 @@
if host:
dsn_dict["host"] = host
if port:
- if backend == 'pygresql':
+ if driver == 'pygresql':
dsn_dict["host"] = "%s:%d" % (host, port)
else:
if psycopg.__version__.split('.')[0] == '1':
@@ -68,7 +69,7 @@
dsn_dict["password"] = password
self.use_dsn = dsn is not None
if dsn is None:
- if backend == 'pygresql':
+ if driver == 'pygresql':
dsn = ''
if host:
dsn += host
@@ -94,6 +95,7 @@
if port:
dsn.append('port=%d' % port)
dsn = ' '.join(dsn)
+ self.driver = driver
self.dsn = dsn
self.unicodeCols = kw.pop('unicodeCols', False)
self.schema = kw.pop('schema', None)
@@ -321,7 +323,7 @@
# We have to connect to *some* database, so we'll connect to
# template1, which is a common open database.
# @@: This doesn't use self.use_dsn or self.dsn_dict
- if self.backend == 'pygresql':
+ if self.driver == 'pygresql':
dsn = '%s:template1:%s:%s' % (
self.host or '', self.user or '', self.password or '')
else:
Modified: SQLObject/branches/0.12/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/sqlite/sqliteconnection.py 2010-07-12 19:45:19 UTC (rev 4206)
+++ SQLObject/branches/0.12/sqlobject/sqlite/sqliteconnection.py 2010-07-15 14:56:25 UTC (rev 4207)
@@ -22,29 +22,30 @@
schemes = [dbName]
def __init__(self, filename, autoCommit=1, **kw):
- backends = kw.pop('backend', None) or 'pysqlite2,sqlite3,sqlite'
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ drivers = kw.pop('driver', None) or \
+ kw.pop('backend', None) or 'pysqlite2,sqlite3,sqlite'
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend in ('sqlite2', 'pysqlite2'):
+ if driver in ('sqlite2', 'pysqlite2'):
from pysqlite2 import dbapi2 as sqlite
self.using_sqlite2 = True
- elif backend == 'sqlite3':
+ elif driver == 'sqlite3':
import sqlite3 as sqlite
self.using_sqlite2 = True
- elif backend in ('sqlite', 'sqlite1'):
+ elif driver in ('sqlite', 'sqlite1'):
import sqlite
self.using_sqlite2 = False
else:
- raise ValueError('Unknown SQLite backend "%s", expected pysqlite2, sqlite3 or sqlite' % backend)
+ raise ValueError('Unknown SQLite driver "%s", expected pysqlite2, sqlite3 or sqlite' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find an SQLite backend, tried %s' % backends)
+ raise ImportError('Cannot find an SQLite driver, tried %s' % drivers)
if self.using_sqlite2:
sqlite.encode = base64.encodestring
sqlite.decode = base64.decodestring
|
|
From: <sub...@co...> - 2010-07-12 19:45:28
|
Author: phd Date: 2010-07-12 13:45:19 -0600 (Mon, 12 Jul 2010) New Revision: 4206 Modified: SQLObject/trunk/docs/News.txt Log: Removed old news. Changed wording of the fresh news. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-07-12 15:47:53 UTC (rev 4205) +++ SQLObject/trunk/docs/News.txt 2010-07-12 19:45:19 UTC (rev 4206) @@ -166,22 +166,31 @@ * Fixed a bug in FirebirdConnection. -* A change ported from `SQLObject 0.10.9`_. +* The cache culling algorithm was enhanced to eliminate memory leaks by + removing references to dead objects; tested on a website that runs around + 4 million requests a day. SQLObject 0.11.2 ================ Released 30 Sep 2009. -* A number of changes ported from `SQLObject 0.10.8`_. +* Fixed a bug in logging to console - convert unicode to str. +* Fixed an obscure bug in ConnectionHub triggered by an SQLObject class + whose instances can be coerced to boolean False. + SQLObject 0.11.1 ================ Released 20 Sep 2009. -* A number of changes ported from `SQLObject 0.10.7`_. +* Fixed a bug: Sybase tables with identity column fire two identity_inserts. +* Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a + backslash) all special characters (backslashes, underscores and percent + signs). + SQLObject 0.11.0 ================ @@ -230,377 +239,6 @@ * Changed the order of testing of SQLite modules - look for external PySQLite2 before sqlite3. -SQLObject 0.10.9 -================ - -* The cache culling algorithm was enhanced to eliminate memory leaks by - removing references to dead objects; tested on a website that runs around - 4 million requests a day. - -SQLObject 0.10.8 -================ - -Released 30 Sep 2009. - -* Fixed a bug in logging to console - convert unicode to str. - -* Fixed an obscure bug in ConnectionHub triggered by an SQLObject class - whose instances can be coerced to boolean False. - -SQLObject 0.10.7 -================ - -Released 20 Sep 2009. - -* Fixed a bug: Sybase tables with identity column fire two identity_inserts. - -* Fixed a bug: q.startswith(), q.contains() and q.endswith() escape (with a - backslash) all special characters (backslashes, underscores and percent - signs). - -SQLObject 0.10.6 -================ - -Released 18 May 2009. - -* Better support for Python 2.6: do not import the deprecated sets module. - -* A number of changes ported from `SQLObject 0.9.11`_. - -SQLObject 0.10.5 -================ - -Released 6 May 2009. - -* A number of changes ported from `SQLObject 0.9.10`_. - -* sqlmeta.getColumns() becomes classmethod. - -SQLObject 0.10.4 -================ - -Released 8 Dec 2008. - -* Fixed createSQL constrains generation under MySQL when the table's name - includes the database's name (contains a dot). - -SQLObject 0.10.3 -================ - -Released 1 Dec 2008. - -* A number of changes ported from `SQLObject 0.9.8`_. - -SQLObject 0.10.2 -================ - -Released 30 May 2008. - -* A number of changes ported from `SQLObject 0.9.7`_. - -SQLObject 0.10.1 -================ - -Released 4 May 2008. - -* Fixed a bug: limit doesn't work in sqlbuilder.Select. - -* A number of changes ported from `SQLObject 0.9.6`_. - -SQLObject 0.10.0 -================ - -Released 11 Mar 2008. - -Features & Interface --------------------- - -* Dropped support for Python 2.2. The minimal version of Python for - SQLObject is 2.3 now. - -* Removed actively deprecated attributes; - lowered deprecation level for other attributes to be removed after 0.10. - -* SQLBuilder Select supports the rest of SelectResults options (reversed, - distinct, joins, etc.) - -* SQLObject.select() (i.e., SelectResults) and DBConnection.queryForSelect() - use SQLBuilder Select queries; this make all SELECTs implemented - internally via a single mechanism. - -* SQLBuilder Joins handle SQLExpression tables (not just str/SQLObject/Alias) - and properly sqlrepr. - -* Added SQLBuilder ImportProxy. It allows one to ignore the circular import - issues with referring to SQLObject classes in other files - it uses the - classregistry as the string class names for FK/Joins do, but specifically - intended for SQLBuilder expressions. See - tests/test_sqlbuilder_importproxy.py. - -* Added SelectResults.throughTo. It allows one to traverse relationships - (FK/Join) via SQL, avoiding the intermediate objects. Additionally, it's - a simple mechanism for pre-caching/eager-loading of later FK - relationships (i.e., going to loop over a select of somePeople and ask - for aPerson.group, first call list(somePeople.throughTo.group) to preload - those related groups and use 2 db queries instead of N+1). See - tests/test_select_through.py. - -* Added ViewSQLObject. - -* Added sqlmeta.getColumns() to get all the columns for a class (including - parent classes), excluding the column 'childName' and including the column - 'id'. sqlmeta.asDict() now uses getColumns(), so there is no need to - override it in the inheritable sqlmeta class; this makes asDict() to work - properly on inheritable sqlobjects. - -* Allow MyTable.select(MyTable.q.foreignKey == object) where object is - an instance of SQLObject. - -* Added rich comparison methods; SQLObjects of the same class are - considered equal is they have the same id; other methods return - NotImplemented. - -* RowDestroySignal is sent on destroying an SQLObject instance; postfunctions - are run after the row has been destroyed. - -* Changed the implementation type in BoolCol under SQLite from TINYINT to - BOOLEAN and made fromDatabase machinery to recognize it. - -* MySQLConnection (and DB URI) accept a number of SSL-related parameters: - ssl_key, ssl_cert, ssl_ca, ssl_capath. - -* Use sets instead of dicts in tablesUsed. Dropped tablesUsedDict function; - instead there is tablesUsedSet that returns a set of strings. - -* SQLBuilder tablesUsedSet handles sqlrepr'able objects. - -* Under MySQL, PickleCol no longer used TEXT column types; the smallest - column is now BLOB - it is not possible to create TINYBLOB column. - -SQLObject 0.9.11 -================ - -Released 18 May 2009. - -* Two bugs in SQLiteConnection.columnsFromSchema() were fixed: use - sqlmeta.idName instead of 'id'; convert default 'NULL' to None. - -* Use sqlmeta.idName instead of 'id' in all connection classes. - -* Fixed a bug that prevented to override per class _connection if there is - sqlhub.processConnection. - -SQLObject 0.9.10 -================ - -Released 6 May 2009. - -* Another unicode-related patch for MySQL; required because different - versions of MySQLdb require different handling:: - - - MySQLdb < 1.2.1: only ascii - - MySQLdb = 1.2.1: only unicode - - MySQLdb > 1.2.1: both ascii and unicode - -* Setup requires FormEncode version 1.1.1+. - -* A minor bug was fixed in creating a DecimalValidator - pass the column name - to it. - -* A bug was fixed in InheritableIteration - pass connection to child - klass.select(). - -* A bug was fixed in PostgresConnection.columnsFromSchema() - foreign keys - are now recognized and created as proper ForeignKey with correct - column name and table name. - -* Bugs in PostgresConnection and MSSQLConnection related to properties was - fixed. A note for developers: from now on properties in DBConnection - classes are forbidden as they don't work with Transaction - - Transaction.__getattr__() cannot properly wrap 'self' so a property is - called with wrong 'self'. - -* Transaction instances now explicitly raises TypeError on close() - - without this calling Transaction.close() calls connection.close() which - is wrong. - -* A bug in SQLiteConnection.columnsFromSchema() that led to an infinite - loop was fixed. - -SQLObject 0.9.9 -=============== - -* Backported from the trunk: under MySQL use the connection's dbEncoding - instead of ascii, when converting a unicode value from python to database - for a StringCol. - -SQLObject 0.9.8 -=============== - -Released 1 Dec 2008. - -* Changed interpretation of strings in the DB URI for boolean parameters: - '0', 'no', 'off' and 'false' are now interpreted as False. - -* Fixed a bug with incorrect handling of calls like - connectionForURI(dburi, cache=False) when dburi already contains some - parameters in the URI. - -* Convert decimal.to_eng_string() to str to work around a bug in Python 2.5.2; - see http://mail.python.org/pipermail/python-dev/2008-March/078189.html - -* Added test_default_style.py. - -* Fixed a minor bug in SQLiteConnection that fails to parse Enum columns. - -SQLObject 0.9.7 -=============== - -Released 30 May 2008. - -Small Features --------------- - -* Use VARCHAR(MAX) and VARBINARY(MAX) for MSSQL >= 9.0. - -* Run post_funcs after RowDestroySignal. - -Bug Fixes ---------- - -* Fixed a minor bug in Set column. - -* A bug fixed for RowCreatedSignal together with InheritableSQLObject: - run post_funcs after the entire hierarchy has been created. - -* Aggregate functions now honors 'distinct'. - -SQLObject 0.9.6 -=============== - -Released 4 May 2008. - -* A bug in inheritable delColumn() that doesn't remove properties was fixed. - -* A minor bug was fixed in col.py - the registry must be passed to findClass(). - -* Reverted the patch declarative.threadSafeMethod() - it causes more harm - then good. - -SQLObject 0.9.5 -=============== - -Released 10 Mar 2008. - -* Fixed a minor bug in SQLiteConnection.columnsFromSchema() - set dbName. - -* A bug in delColumn() that removes all properties was fixed by recreating - properties. - -SQLObject 0.9.4 -=============== - -Released 3 Mar 2008. - -* Use list.reverse() in manager/command.py for Python 2.2 compatibility. - -* Prevent MultipleJoin from removing the intermediate table if it was not - created by the Join. - -* Fixed a bug with no default when defaultSQL is defined for the column. - -* Recognize POINT data type as string in PostgresConnection.columnsFromSchema(). - -SQLObject 0.9.3 -=============== - -Released 10 Jan 2008. - -* A number of changes ported from SQLObject 0.7.10. - -SQLObject 0.9.2 -=============== - -Released 30 Oct 2007. - -* Fixed a bug in Versioning - do not copy "alternateID" and "unique" - attributes from the versioned table. - -* Fixed a misspelled 'zerofill' option's name. - -* Fixed bugs in SQLiteConnection.guessColumn(). - -* A number of changes ported from SQLObject 0.7.9 and SQLObject 0.8.6. - -SQLObject 0.9.1 -=============== - -Released 25 July 2007. - -Bug Fixes ---------- - -* Fixed misspelled methods in col.py. - -* A number of bugfixes ported from SQLObject 0.7.8 and SQLObject 0.8.5. - -SQLObject 0.9.0 -=============== - -Released 10 May 2007. - -Features & Interface --------------------- - -* Support for Python 2.2 has been declared obsolete. - -* Removed actively deprecated attributes; - lowered deprecation level for other attributes to be removed after 0.9. - -* SQLite connection got columnsFromSchema(). Now all connections fully support - fromDatabase. There are two version of columnsFromSchema() for SQLite - - one parses the result of "SELECT sql FROM sqlite_master" and the other - uses "PRAGMA table_info"; the user can choose one over the other by using - "use_table_info" parameter in DB URI; default is False as the pragma is - available only in the later versions of SQLite. - -* Changed connection.delColumn(): the first argument is sqlmeta, not - tableName (required for SQLite). - -* SQLite connection got delColumn(). Now all connections fully support - delColumn(). As SQLite backend doesn't implement "ALTER TABLE DROP COLUMN" - delColumn() is implemented by creating a new table without the column, - copying all data, dropping the original table and renaming the new table. - -* Versioning_. - -.. _Versioning: Versioning.html - -* MySQLConnection got new keyword "conv" - a list of custom converters. - -* Use logging if it's available and is configured via DB URI. - -* New columns: TimestampCol to support MySQL TIMESTAMP type; - SetCol to support MySQL SET type; - TinyIntCol for TINYINT; SmallIntCol for SMALLINT; - MediumIntCol for MEDIUMINT; BigIntCol for BIGINT. - -Small Features --------------- - -* Support for MySQL INT type attributes: UNSIGNED, ZEROFILL. - -* Support for DEFAULT SQL attribute via defaultSQL keyword argument. - -* cls.tableExists() as a shortcut for conn.tableExists(cls.sqlmeta.table). - -* cls.deleteMany(), cls.deleteBy(). - -Bug Fixes ---------- - -* idName can be inherited from the parent sqlmeta class. - .. image:: http://sflogo.sourceforge.net/sflogo.php?group_id=74338&type=10 :target: http://sourceforge.net/projects/sqlobject :class: noborder |
|
From: <sub...@co...> - 2010-07-12 15:47:59
|
Author: phd
Date: 2010-07-12 09:47:53 -0600 (Mon, 12 Jul 2010)
New Revision: 4205
Modified:
SQLObject/trunk/sqlobject/tests/test_validation.py
Log:
Test instances of classes with special methods.
Modified: SQLObject/trunk/sqlobject/tests/test_validation.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_validation.py 2010-07-12 15:26:34 UTC (rev 4204)
+++ SQLObject/trunk/sqlobject/tests/test_validation.py 2010-07-12 15:47:53 UTC (rev 4205)
@@ -8,14 +8,36 @@
class SOValidation(SQLObject):
- name = StringCol(validator=validators.PlainText(), default='x', dbName='name_col')
+ name = StringCol(validator=validators.PlainText(),
+ default='x', dbName='name_col')
name2 = StringCol(validator=validators.ConfirmType(type=str), default='y')
name3 = IntCol(validator=validators.Wrapper(fromPython=int), default=100)
name4 = FloatCol(default=2.718)
name5 = PickleCol(default=None)
name6 = BoolCol(default=None)
name7 = UnicodeCol(default=None)
+ name8 = IntCol(default=None)
+class SOValidationTest(object):
+ def __init__(self, value):
+ self.value = value
+
+class SOValidationTestUnicode(SOValidationTest):
+ def __unicode__(self):
+ return self.value
+
+class SOValidationTestInt(SOValidationTest):
+ def __int__(self):
+ return self.value
+
+class SOValidationTestBool(SOValidationTest):
+ def __nonzero__(self):
+ return self.value
+
+class SOValidationTestFloat(SOValidationTest):
+ def __float__(self):
+ return self.value
+
class TestValidation:
def setup_method(self, meth):
@@ -37,6 +59,14 @@
t.name2 = 'you'
assert t.name2 == 'you'
+ for name, cls, value in (
+ ('name4', SOValidationTestFloat, 1.1),
+ ('name6', SOValidationTestBool, True),
+ ('name7', SOValidationTestUnicode, u'test'),
+ ('name8', SOValidationTestInt, 1)):
+ setattr(t, name, cls(value))
+ assert getattr(t, name) == value
+
def test_wrapType(self):
t = SOValidation(name3=1)
raises(validators.Invalid, setattr, t, 'name3', 'x')
|
|
From: <sub...@co...> - 2010-07-12 15:26:41
|
Author: phd Date: 2010-07-12 09:26:34 -0600 (Mon, 12 Jul 2010) New Revision: 4204 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/col.py SQLObject/trunk/sqlobject/tests/test_validation.py Log: StringCol and UnicodeCol now accept an instance of a class that implements __unicode__. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-07-12 15:03:09 UTC (rev 4203) +++ SQLObject/trunk/docs/News.txt 2010-07-12 15:26:34 UTC (rev 4204) @@ -16,12 +16,13 @@ * SQLObject instances that don't have a per-instance connection can be pickled and unpickled. -* Validators became stricter: StringCol and UnicodeCol now accept only str - or unicode; BoolCol accepts only bool or int or an instance of a class - that implements __nonzero__; IntCol accepts int, long or an instance of a - class that implements __int__ or __long__; FloatCol accepts float, int, - long or an instance of a class that implements __float__, __int__ or - __long__. +* Validators became stricter: StringCol and UnicodeCol now accept only str, + unicode or an instance of a class that implements __unicode__ (but not + __str__ because every object has a __str__ method); BoolCol accepts only + bool or int or an instance of a class that implements __nonzero__; IntCol + accepts int, long or an instance of a class that implements __int__ or + __long__; FloatCol accepts float, int, long or an instance of a class + that implements __float__, __int__ or __long__. * Added a connection class for rdbhost.com (commercial Postgres-over-Web service). Modified: SQLObject/trunk/sqlobject/col.py =================================================================== --- SQLObject/trunk/sqlobject/col.py 2010-07-12 15:03:09 UTC (rev 4203) +++ SQLObject/trunk/sqlobject/col.py 2010-07-12 15:26:34 UTC (rev 4204) @@ -513,13 +513,15 @@ if value is None: return None connection = state.soObject._connection + dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" if isinstance(value, unicode): - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" return value.encode(dbEncoding) if self.dataType and isinstance(value, self.dataType): return value if isinstance(value, (str, buffer, connection._binaryType, sqlbuilder.SQLExpression)): return value + if hasattr(value, '__unicode__'): + return unicode(value).encode(dbEncoding) raise validators.Invalid("expected a str in the StringCol '%s', got %s %r instead" % \ (self.name, type(value), value), value, state) @@ -545,6 +547,8 @@ return unicode(value, self.dbEncoding) if isinstance(value, array): # MySQL return unicode(value.tostring(), self.dbEncoding) + if hasattr(value, '__unicode__'): + return unicode(value) raise validators.Invalid("expected a str or a unicode in the UnicodeCol '%s', got %s %r instead" % \ (self.name, type(value), value), value, state) @@ -555,6 +559,8 @@ return value if isinstance(value, unicode): return value.encode(self.dbEncoding) + if hasattr(value, '__unicode__'): + return unicode(value).encode(self.dbEncoding) raise validators.Invalid("expected a str or a unicode in the UnicodeCol '%s', got %s %r instead" % \ (self.name, type(value), value), value, state) Modified: SQLObject/trunk/sqlobject/tests/test_validation.py =================================================================== --- SQLObject/trunk/sqlobject/tests/test_validation.py 2010-07-12 15:03:09 UTC (rev 4203) +++ SQLObject/trunk/sqlobject/tests/test_validation.py 2010-07-12 15:26:34 UTC (rev 4204) @@ -14,6 +14,7 @@ name4 = FloatCol(default=2.718) name5 = PickleCol(default=None) name6 = BoolCol(default=None) + name7 = UnicodeCol(default=None) class TestValidation: @@ -32,6 +33,7 @@ raises(validators.Invalid, setattr, t, 'name3', '1') raises(validators.Invalid, setattr, t, 'name4', '1') raises(validators.Invalid, setattr, t, 'name6', '1') + raises(validators.Invalid, setattr, t, 'name7', 1) t.name2 = 'you' assert t.name2 == 'you' |
|
From: <sub...@co...> - 2010-07-12 15:03:16
|
Author: phd
Date: 2010-07-12 09:03:09 -0600 (Mon, 12 Jul 2010)
New Revision: 4203
Modified:
SQLObject/trunk/sqlobject/col.py
Log:
Joined conditions.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2010-07-12 14:52:52 UTC (rev 4202)
+++ SQLObject/trunk/sqlobject/col.py 2010-07-12 15:03:09 UTC (rev 4203)
@@ -660,10 +660,8 @@
return None
if isinstance(value, (bool, sqlbuilder.SQLExpression)):
return value
- if isinstance(value, (int, long)):
+ if isinstance(value, (int, long)) or hasattr(value, '__nonzero__'):
return bool(value)
- if hasattr(value, '__nonzero__'):
- return bool(value)
raise validators.Invalid("expected a bool or an int in the BoolCol '%s', got %s %r instead" % \
(self.name, type(value), value), value, state)
|
|
From: <sub...@co...> - 2010-07-12 14:52:59
|
Author: phd Date: 2010-07-12 08:52:52 -0600 (Mon, 12 Jul 2010) New Revision: 4202 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/col.py SQLObject/trunk/sqlobject/tests/test_validation.py Log: BoolCol accepts an instance of a class that implements __nonzero__. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-07-12 14:47:39 UTC (rev 4201) +++ SQLObject/trunk/docs/News.txt 2010-07-12 14:52:52 UTC (rev 4202) @@ -17,10 +17,11 @@ pickled and unpickled. * Validators became stricter: StringCol and UnicodeCol now accept only str - or unicode; BoolCol accepts only bool or int; IntCol accepts int, long or - an instance of a class that implements __int__ or __long__; FloatCol - accepts float, int, long or an instance of a class that implements - __float__, __int__ or __long__. + or unicode; BoolCol accepts only bool or int or an instance of a class + that implements __nonzero__; IntCol accepts int, long or an instance of a + class that implements __int__ or __long__; FloatCol accepts float, int, + long or an instance of a class that implements __float__, __int__ or + __long__. * Added a connection class for rdbhost.com (commercial Postgres-over-Web service). Modified: SQLObject/trunk/sqlobject/col.py =================================================================== --- SQLObject/trunk/sqlobject/col.py 2010-07-12 14:47:39 UTC (rev 4201) +++ SQLObject/trunk/sqlobject/col.py 2010-07-12 14:52:52 UTC (rev 4202) @@ -662,6 +662,8 @@ return value if isinstance(value, (int, long)): return bool(value) + if hasattr(value, '__nonzero__'): + return bool(value) raise validators.Invalid("expected a bool or an int in the BoolCol '%s', got %s %r instead" % \ (self.name, type(value), value), value, state) Modified: SQLObject/trunk/sqlobject/tests/test_validation.py =================================================================== --- SQLObject/trunk/sqlobject/tests/test_validation.py 2010-07-12 14:47:39 UTC (rev 4201) +++ SQLObject/trunk/sqlobject/tests/test_validation.py 2010-07-12 14:52:52 UTC (rev 4202) @@ -13,6 +13,7 @@ name3 = IntCol(validator=validators.Wrapper(fromPython=int), default=100) name4 = FloatCol(default=2.718) name5 = PickleCol(default=None) + name6 = BoolCol(default=None) class TestValidation: @@ -21,24 +22,22 @@ def test_validate(self): t = SOValidation(name='hey') - raises(validators.Invalid, setattr, t, - 'name', '!!!') + raises(validators.Invalid, setattr, t, 'name', '!!!') t.name = 'you' + assert t.name == 'you' def test_confirmType(self): t = SOValidation(name2='hey') - raises(validators.Invalid, setattr, t, - 'name2', 1) - raises(validators.Invalid, setattr, t, - 'name3', '1') - raises(validators.Invalid, setattr, t, - 'name4', '1') + raises(validators.Invalid, setattr, t, 'name2', 1) + raises(validators.Invalid, setattr, t, 'name3', '1') + raises(validators.Invalid, setattr, t, 'name4', '1') + raises(validators.Invalid, setattr, t, 'name6', '1') t.name2 = 'you' + assert t.name2 == 'you' def test_wrapType(self): t = SOValidation(name3=1) - raises(validators.Invalid, setattr, t, - 'name3', 'x') + raises(validators.Invalid, setattr, t, 'name3', 'x') t.name3 = 1L assert t.name3 == 1 t.name3 = 0 |
|
From: <sub...@co...> - 2010-07-12 14:47:46
|
Author: phd
Date: 2010-07-12 08:47:39 -0600 (Mon, 12 Jul 2010)
New Revision: 4201
Modified:
SQLObject/branches/0.12/sqlobject/tests/test_validation.py
Log:
Merged revision from branch 0.11: joined lines.
Modified: SQLObject/branches/0.12/sqlobject/tests/test_validation.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/tests/test_validation.py 2010-07-12 14:45:58 UTC (rev 4200)
+++ SQLObject/branches/0.12/sqlobject/tests/test_validation.py 2010-07-12 14:47:39 UTC (rev 4201)
@@ -21,24 +21,21 @@
def test_validate(self):
t = SOValidation(name='hey')
- raises(validators.Invalid, setattr, t,
- 'name', '!!!')
+ raises(validators.Invalid, setattr, t, 'name', '!!!')
t.name = 'you'
+ assert t.name == 'you'
def test_confirmType(self):
t = SOValidation(name2='hey')
- raises(validators.Invalid, setattr, t,
- 'name2', 1)
- raises(validators.Invalid, setattr, t,
- 'name3', '1')
- raises(validators.Invalid, setattr, t,
- 'name4', '1')
+ raises(validators.Invalid, setattr, t, 'name2', 1)
+ raises(validators.Invalid, setattr, t, 'name3', '1')
+ raises(validators.Invalid, setattr, t, 'name4', '1')
t.name2 = 'you'
+ assert t.name2 == 'you'
def test_wrapType(self):
t = SOValidation(name3=1)
- raises(validators.Invalid, setattr, t,
- 'name3', 'x')
+ raises(validators.Invalid, setattr, t, 'name3', 'x')
t.name3 = 1L
assert t.name3 == 1
t.name3 = 0
|
|
From: <sub...@co...> - 2010-07-12 14:46:08
|
Author: phd
Date: 2010-07-12 08:45:58 -0600 (Mon, 12 Jul 2010)
New Revision: 4200
Modified:
SQLObject/branches/0.11/sqlobject/tests/test_validation.py
Log:
Joined lines.
Modified: SQLObject/branches/0.11/sqlobject/tests/test_validation.py
===================================================================
--- SQLObject/branches/0.11/sqlobject/tests/test_validation.py 2010-07-02 15:35:45 UTC (rev 4199)
+++ SQLObject/branches/0.11/sqlobject/tests/test_validation.py 2010-07-12 14:45:58 UTC (rev 4200)
@@ -21,24 +21,21 @@
def test_validate(self):
t = SOValidation(name='hey')
- raises(validators.Invalid, setattr, t,
- 'name', '!!!')
+ raises(validators.Invalid, setattr, t, 'name', '!!!')
t.name = 'you'
+ assert t.name == 'you'
def test_confirmType(self):
t = SOValidation(name2='hey')
- raises(validators.Invalid, setattr, t,
- 'name2', 1)
- raises(validators.Invalid, setattr, t,
- 'name3', '1')
- raises(validators.Invalid, setattr, t,
- 'name4', '1')
+ raises(validators.Invalid, setattr, t, 'name2', 1)
+ raises(validators.Invalid, setattr, t, 'name3', '1')
+ raises(validators.Invalid, setattr, t, 'name4', '1')
t.name2 = 'you'
+ assert t.name2 == 'you'
def test_wrapType(self):
t = SOValidation(name3=1)
- raises(validators.Invalid, setattr, t,
- 'name3', 'x')
+ raises(validators.Invalid, setattr, t, 'name3', 'x')
t.name3 = 1L
assert t.name3 == 1
t.name3 = 0
|
|
From: <sub...@co...> - 2010-07-02 15:35:51
|
Author: phd
Date: 2010-07-02 09:35:45 -0600 (Fri, 02 Jul 2010)
New Revision: 4199
Added:
SQLObject/trunk/sqlobject/tests/test_psycopg_sslmode.py
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/postgres/pgconnection.py
Log:
A new parameter 'sslmode' was added to PostgresConnection.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-07-02 15:21:12 UTC (rev 4198)
+++ SQLObject/trunk/docs/News.txt 2010-07-02 15:35:45 UTC (rev 4199)
@@ -40,6 +40,8 @@
* Renamed db_encoding to dbEncoding in UnicodeStringValidator.
+* A new parameter 'sslmode' was added to PostgresConnection.
+
SQLObject 0.12.4
================
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py 2010-07-02 15:21:12 UTC (rev 4198)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py 2010-07-02 15:35:45 UTC (rev 4199)
@@ -66,6 +66,9 @@
dsn_dict["user"] = user
if password:
dsn_dict["password"] = password
+ sslmode = kw.pop("sslmode", None)
+ if sslmode:
+ dsn_dict["sslmode"] = sslmode
self.use_dsn = dsn is not None
if dsn is None:
if backend == 'pygresql':
@@ -93,6 +96,8 @@
dsn.append('host=%s' % host)
if port:
dsn.append('port=%d' % port)
+ if sslmode:
+ dsn.append('sslmode=%s' % sslmode)
dsn = ' '.join(dsn)
self.dsn = dsn
self.unicodeCols = kw.pop('unicodeCols', False)
Added: SQLObject/trunk/sqlobject/tests/test_psycopg_sslmode.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_psycopg_sslmode.py (rev 0)
+++ SQLObject/trunk/sqlobject/tests/test_psycopg_sslmode.py 2010-07-02 15:35:45 UTC (rev 4199)
@@ -0,0 +1,25 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## Test PosgreSQL sslmode
+########################################
+
+class TestSSLMode(SQLObject):
+ test = StringCol()
+
+def test_sslmode():
+ setupClass(TestSSLMode)
+ connection = TestSSLMode._connection
+ if (connection.dbName != 'postgres') or \
+ (not connection.module.__name__.startswith('psycopg')):
+ # sslmode is only implemented by psycopg[12] PostgreSQL driver
+ return
+
+ connection = getConnection(sslmode='require')
+ TestSSLMode._connection = connection
+ test = TestSSLMode(test='test') # Connect to the DB to test sslmode
+
+ connection.cache.clear()
+ test = TestSSLMode.select()[0]
+ assert test.test == 'test'
|
|
From: <sub...@co...> - 2010-07-02 15:21:18
|
Author: phd
Date: 2010-07-02 09:21:12 -0600 (Fri, 02 Jul 2010)
New Revision: 4198
Modified:
SQLObject/trunk/sqlobject/postgres/pgconnection.py
Log:
Merged r4197 from branch 0.12: get unicodeCols and dbEncoding from kw.
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py 2010-07-02 15:19:22 UTC (rev 4197)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py 2010-07-02 15:21:12 UTC (rev 4198)
@@ -11,8 +11,7 @@
schemes = [dbName, 'postgresql']
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, backend='psycopg', unicodeCols=False,
- **kw):
+ user=None, password=None, backend='psycopg', **kw):
backends = backend
for backend in backends.split(','):
backend = backend.strip()
@@ -96,12 +95,9 @@
dsn.append('port=%d' % port)
dsn = ' '.join(dsn)
self.dsn = dsn
- self.unicodeCols = unicodeCols
+ self.unicodeCols = kw.pop('unicodeCols', False)
self.schema = kw.pop('schema', None)
- if "charset" in kw:
- self.dbEncoding = kw.pop("charset")
- else:
- self.dbEncoding = None
+ self.dbEncoding = kw.pop("charset", None)
DBAPI.__init__(self, **kw)
def connectionFromURI(cls, uri):
|
|
From: <sub...@co...> - 2010-07-02 15:19:28
|
Author: phd
Date: 2010-07-02 09:19:22 -0600 (Fri, 02 Jul 2010)
New Revision: 4197
Modified:
SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py
Log:
Get unicodeCols and dbEncoding from kw.
Modified: SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py 2010-07-02 15:15:00 UTC (rev 4196)
+++ SQLObject/branches/0.12/sqlobject/postgres/pgconnection.py 2010-07-02 15:19:22 UTC (rev 4197)
@@ -11,8 +11,7 @@
schemes = [dbName, 'postgresql']
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, backend='psycopg', unicodeCols=False,
- **kw):
+ user=None, password=None, backend='psycopg', **kw):
backends = backend
for backend in backends.split(','):
backend = backend.strip()
@@ -96,12 +95,9 @@
dsn.append('port=%d' % port)
dsn = ' '.join(dsn)
self.dsn = dsn
- self.unicodeCols = unicodeCols
+ self.unicodeCols = kw.pop('unicodeCols', False)
self.schema = kw.pop('schema', None)
- if "charset" in kw:
- self.dbEncoding = kw.pop("charset")
- else:
- self.dbEncoding = None
+ self.dbEncoding = kw.pop("charset", None)
DBAPI.__init__(self, **kw)
def connectionFromURI(cls, uri):
|
|
From: <sub...@co...> - 2010-07-02 15:15:08
|
Author: phd
Date: 2010-07-02 09:15:00 -0600 (Fri, 02 Jul 2010)
New Revision: 4196
Modified:
SQLObject/branches/0.11/sqlobject/postgres/pgconnection.py
Log:
Get unicodeCols from kw.
Modified: SQLObject/branches/0.11/sqlobject/postgres/pgconnection.py
===================================================================
--- SQLObject/branches/0.11/sqlobject/postgres/pgconnection.py 2010-05-11 20:32:50 UTC (rev 4195)
+++ SQLObject/branches/0.11/sqlobject/postgres/pgconnection.py 2010-07-02 15:15:00 UTC (rev 4196)
@@ -13,8 +13,7 @@
schemes = [dbName, 'postgresql', 'psycopg']
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, usePygresql=False, unicodeCols=False,
- **kw):
+ user=None, password=None, usePygresql=False, **kw):
global psycopg, pgdb
self.usePygresql = usePygresql
if usePygresql:
@@ -84,7 +83,7 @@
dsn.append('port=%d' % port)
dsn = ' '.join(dsn)
self.dsn = dsn
- self.unicodeCols = unicodeCols
+ self.unicodeCols = kw.pop('unicodeCols', False)
self.schema = kw.pop('schema', None)
DBAPI.__init__(self, **kw)
|
|
From: SourceForge.net <no...@so...> - 2010-06-18 08:10:45
|
Bugs item #3009526, was opened at 2010-05-31 19:45 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3009526&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Postgres Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Philipp (philipp777) >Assigned to: Oleg Broytman (phd) Summary: cannot delete objects when many-to-many still none Initial Comment: I have objects with many-to-many relationships. However it may happen that none of these relationships was set, when I want to delete one of the objects. Python returns the following error: psycopg2.ProgrammingError: relation "none" does not exist I fixed it by inserting: if join.intermediateTable: In function destroySelf() before starting the SQL query to delete the entry in the intermediate table. Which apparently is not created if no many-to-many relationship have been set. Another approach would be to make sure that an intermediate table exists even when there are still no entries defined. This would probably be more secure if other functions also assume that this table already exists. SQLObject version 12.3, Python 2.6, Postgres 8.4 ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2010-06-18 12:10 Message: Can you write a short script to demonstrate the problem? I will turn it into a test case. Thanks in advance. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3009526&group_id=74338 |