sqlobject-cvs Mailing List for SQLObject (Page 45)
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-10-09 02:00:58
|
Author: phd
Date: 2010-10-08 20:00:48 -0600 (Fri, 08 Oct 2010)
New Revision: 4247
Added:
SQLObject/branches/0.12/sqlobject/tests/test_string_id.py
Removed:
SQLObject/branches/0.12/sqlobject/tests/test_string_id.py
SQLObject/branches/0.12/sqlobject/tests/test_stringid.py
Log:
Removed test_string_id.py. Renamed test_stringid.py to test_string_id.py. Added tests.
Deleted: SQLObject/branches/0.12/sqlobject/tests/test_string_id.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/tests/test_string_id.py 2010-10-05 16:25:00 UTC (rev 4246)
+++ SQLObject/branches/0.12/sqlobject/tests/test_string_id.py 2010-10-09 02:00:48 UTC (rev 4247)
@@ -1,17 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-class TestStringID(SQLObject):
- class sqlmeta(sqlmeta):
- idType = str
- idName = 'test_id_here'
- name = StringCol(length=100)
-
-def test_string_id():
- conn = getConnection()
- TestStringID.setConnection(conn)
- TestStringID.dropTable(ifExists=True)
- assert not conn.tableExists(TestStringID.sqlmeta.table)
- TestStringID.createTable()
- TestStringID(id="TestStringID", name="TestStringID name")
- assert len(list(TestStringID.selectBy(id='TestStringID'))) == 1
Copied: SQLObject/branches/0.12/sqlobject/tests/test_string_id.py (from rev 4212, SQLObject/branches/0.12/sqlobject/tests/test_stringid.py)
===================================================================
--- SQLObject/branches/0.12/sqlobject/tests/test_string_id.py (rev 0)
+++ SQLObject/branches/0.12/sqlobject/tests/test_string_id.py 2010-10-09 02:00:48 UTC (rev 4247)
@@ -0,0 +1,76 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## String ID test
+########################################
+
+class SOStringID(SQLObject):
+
+ class sqlmeta(sqlmeta):
+ table = 'so_string_id'
+ idType = str
+ val = StringCol(alternateID=True)
+
+ mysqlCreate = """
+ CREATE TABLE IF NOT EXISTS so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ postgresCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ sybaseCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) UNIQUE,
+ val VARCHAR(50) NULL
+ )
+ """
+
+ firebirdCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) NOT NULL PRIMARY KEY,
+ val BLOB SUB_TYPE TEXT
+ )
+ """
+
+ mssqlCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val varchar(4000)
+ )
+ """
+
+ sqliteCreate = postgresCreate
+
+ mysqlDrop = """
+ DROP TABLE IF EXISTS so_string_id
+ """
+
+ postgresDrop = """
+ DROP TABLE so_string_id
+ """
+
+ sqliteDrop = postgresDrop
+ firebirdDrop = postgresDrop
+ mssqlDrop = postgresDrop
+
+def test_stringID():
+ setupClass(SOStringID)
+ t1 = SOStringID(id='hey', val='whatever')
+ t2 = SOStringID.byVal('whatever')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'whatever'
+
+ t1 = SOStringID(id='you', val='nowhere')
+ t2 = SOStringID.get('you')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'nowhere'
Property changes on: SQLObject/branches/0.12/sqlobject/tests/test_string_id.py
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: SQLObject/branches/0.12/sqlobject/tests/test_stringid.py
===================================================================
--- SQLObject/branches/0.12/sqlobject/tests/test_stringid.py 2010-10-05 16:25:00 UTC (rev 4246)
+++ SQLObject/branches/0.12/sqlobject/tests/test_stringid.py 2010-10-09 02:00:48 UTC (rev 4247)
@@ -1,71 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-########################################
-## String ID test
-########################################
-
-class SOStringID(SQLObject):
-
- class sqlmeta(sqlmeta):
- table = 'so_string_id'
- idType = str
- val = StringCol(alternateID=True)
-
- mysqlCreate = """
- CREATE TABLE IF NOT EXISTS so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- postgresCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- sybaseCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) UNIQUE,
- val VARCHAR(50) NULL
- )
- """
-
- firebirdCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) NOT NULL PRIMARY KEY,
- val BLOB SUB_TYPE TEXT
- )
- """
-
- mssqlCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val varchar(4000)
- )
- """
-
- sqliteCreate = postgresCreate
-
- mysqlDrop = """
- DROP TABLE IF EXISTS so_string_id
- """
-
- postgresDrop = """
- DROP TABLE so_string_id
- """
-
- sqliteDrop = postgresDrop
- firebirdDrop = postgresDrop
- mssqlDrop = postgresDrop
-
-def test_stringID():
- setupClass(SOStringID)
- t = SOStringID(id='hey', val='whatever')
- t2 = SOStringID.byVal('whatever')
- assert t == t2
- t3 = SOStringID(id='you', val='nowhere')
- t4 = SOStringID.get('you')
- assert t3 == t4
|
|
From: <sub...@co...> - 2010-10-05 16:25:06
|
Author: phd Date: 2010-10-05 10:25:00 -0600 (Tue, 05 Oct 2010) New Revision: 4246 Modified: SQLObject/trunk/docs/News.txt Log: There is branch 0.14. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-10-05 16:23:15 UTC (rev 4245) +++ SQLObject/trunk/docs/News.txt 2010-10-05 16:25:00 UTC (rev 4246) @@ -13,6 +13,12 @@ Features & Interface -------------------- +SQLObject 0.14.0 +================ + +Features & Interface +-------------------- + * The lists of columns/indices/joins are now sorted according to the order of creation. |
|
From: <sub...@co...> - 2010-10-05 16:23:21
|
Author: phd Date: 2010-10-05 10:23:15 -0600 (Tue, 05 Oct 2010) New Revision: 4245 Modified: SQLObject/branches/0.14/docs/News.txt Log: The branch will be released as SQLObject 0.14.0. Modified: SQLObject/branches/0.14/docs/News.txt =================================================================== --- SQLObject/branches/0.14/docs/News.txt 2010-10-05 16:18:06 UTC (rev 4244) +++ SQLObject/branches/0.14/docs/News.txt 2010-10-05 16:23:15 UTC (rev 4245) @@ -7,7 +7,7 @@ .. _start: -SQLObject (trunk) +SQLObject 0.14.0 ================= Features & Interface |
|
From: <sub...@co...> - 2010-10-05 16:18:13
|
Author: phd
Date: 2010-10-05 10:18:06 -0600 (Tue, 05 Oct 2010)
New Revision: 4244
Modified:
SQLObject/trunk/README.txt
SQLObject/trunk/setup.py
SQLObject/trunk/sqlobject/__init__.py
SQLObject/trunk/sqlobject/main.py
Log:
The trunk will be branch 0.15.
Modified: SQLObject/trunk/README.txt
===================================================================
--- SQLObject/trunk/README.txt 2010-10-05 16:06:53 UTC (rev 4243)
+++ SQLObject/trunk/README.txt 2010-10-05 16:18:06 UTC (rev 4244)
@@ -1,4 +1,4 @@
-SQLObject 0.13
+SQLObject 0.15
==============
Thanks for looking at SQLObject. SQLObject is an object-relational
Modified: SQLObject/trunk/setup.py
===================================================================
--- SQLObject/trunk/setup.py 2010-10-05 16:06:53 UTC (rev 4243)
+++ SQLObject/trunk/setup.py 2010-10-05 16:18:06 UTC (rev 4244)
@@ -21,7 +21,7 @@
"""
setup(name="SQLObject",
- version="0.14",
+ version="0.15",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
Modified: SQLObject/trunk/sqlobject/__init__.py
===================================================================
--- SQLObject/trunk/sqlobject/__init__.py 2010-10-05 16:06:53 UTC (rev 4243)
+++ SQLObject/trunk/sqlobject/__init__.py 2010-10-05 16:18:06 UTC (rev 4244)
@@ -1,5 +1,5 @@
"""
-SQLObject 0.14
+SQLObject 0.15
"""
from col import *
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-10-05 16:06:53 UTC (rev 4243)
+++ SQLObject/trunk/sqlobject/main.py 2010-10-05 16:18:06 UTC (rev 4244)
@@ -1,5 +1,5 @@
"""
-SQLObject 0.14
+SQLObject 0.15
--------------
:author: Ian Bicking <ia...@co...>
|
|
From: <sub...@co...> - 2010-10-05 16:07:00
|
Author: phd
Date: 2010-10-05 10:06:53 -0600 (Tue, 05 Oct 2010)
New Revision: 4243
Modified:
SQLObject/tags/0.14.0b1/README.txt
SQLObject/tags/0.14.0b1/setup.py
SQLObject/tags/0.14.0b1/sqlobject/__init__.py
SQLObject/tags/0.14.0b1/sqlobject/main.py
Log:
Version 0.14.0b1.
Modified: SQLObject/tags/0.14.0b1/README.txt
===================================================================
--- SQLObject/tags/0.14.0b1/README.txt 2010-10-05 16:04:41 UTC (rev 4242)
+++ SQLObject/tags/0.14.0b1/README.txt 2010-10-05 16:06:53 UTC (rev 4243)
@@ -1,5 +1,5 @@
-SQLObject 0.14
-==============
+SQLObject 0.14.0b1
+==================
Thanks for looking at SQLObject. SQLObject is an object-relational
mapper, i.e., a library that will wrap your database tables in Python
Modified: SQLObject/tags/0.14.0b1/setup.py
===================================================================
--- SQLObject/tags/0.14.0b1/setup.py 2010-10-05 16:04:41 UTC (rev 4242)
+++ SQLObject/tags/0.14.0b1/setup.py 2010-10-05 16:06:53 UTC (rev 4243)
@@ -21,7 +21,7 @@
"""
setup(name="SQLObject",
- version="0.14",
+ version="0.14.0b1",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
Modified: SQLObject/tags/0.14.0b1/sqlobject/__init__.py
===================================================================
--- SQLObject/tags/0.14.0b1/sqlobject/__init__.py 2010-10-05 16:04:41 UTC (rev 4242)
+++ SQLObject/tags/0.14.0b1/sqlobject/__init__.py 2010-10-05 16:06:53 UTC (rev 4243)
@@ -1,5 +1,5 @@
"""
-SQLObject 0.14
+SQLObject 0.14.0b1
"""
from col import *
Modified: SQLObject/tags/0.14.0b1/sqlobject/main.py
===================================================================
--- SQLObject/tags/0.14.0b1/sqlobject/main.py 2010-10-05 16:04:41 UTC (rev 4242)
+++ SQLObject/tags/0.14.0b1/sqlobject/main.py 2010-10-05 16:06:53 UTC (rev 4243)
@@ -1,6 +1,6 @@
"""
-SQLObject 0.14
---------------
+SQLObject 0.14.0b1
+------------------
:author: Ian Bicking <ia...@co...>
|
|
From: <sub...@co...> - 2010-10-05 16:04:48
|
Author: phd Date: 2010-10-05 10:04:41 -0600 (Tue, 05 Oct 2010) New Revision: 4242 Added: SQLObject/tags/0.14.0b1/ Log: Tagging 0.14.0b1 Copied: SQLObject/tags/0.14.0b1 (from rev 4241, SQLObject/branches/0.14) |
|
From: <sub...@co...> - 2010-10-05 16:02:55
|
Author: phd Date: 2010-10-05 10:02:47 -0600 (Tue, 05 Oct 2010) New Revision: 4241 Modified: SQLObject/branches/0.14/README.txt SQLObject/branches/0.14/setup.py Log: Branch 0.14. Modified: SQLObject/branches/0.14/README.txt =================================================================== --- SQLObject/branches/0.14/README.txt 2010-10-05 15:59:57 UTC (rev 4240) +++ SQLObject/branches/0.14/README.txt 2010-10-05 16:02:47 UTC (rev 4241) @@ -1,4 +1,4 @@ -SQLObject 0.13 +SQLObject 0.14 ============== Thanks for looking at SQLObject. SQLObject is an object-relational Modified: SQLObject/branches/0.14/setup.py =================================================================== --- SQLObject/branches/0.14/setup.py 2010-10-05 15:59:57 UTC (rev 4240) +++ SQLObject/branches/0.14/setup.py 2010-10-05 16:02:47 UTC (rev 4241) @@ -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.14dev>`_ +<http://svn.colorstudy.com/SQLObject/branches/0.14>`_ """, classifiers=[ "Development Status :: 5 - Production/Stable", |
|
From: <sub...@co...> - 2010-10-05 16:00:03
|
Author: phd Date: 2010-10-05 09:59:57 -0600 (Tue, 05 Oct 2010) New Revision: 4240 Added: SQLObject/branches/0.14/ Log: Branch 0.14 Copied: SQLObject/branches/0.14 (from rev 4239, SQLObject/trunk) |
|
From: <sub...@co...> - 2010-10-05 15:46:40
|
Author: phd
Date: 2010-10-05 09:46:33 -0600 (Tue, 05 Oct 2010)
New Revision: 4239
Modified:
SQLObject/trunk/sqlobject/main.py
Log:
`set_name` and `delete` are always True.
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-09-30 17:37:57 UTC (rev 4238)
+++ SQLObject/trunk/sqlobject/main.py 2010-10-05 15:46:33 UTC (rev 4239)
@@ -143,22 +143,18 @@
depends.append(col)
return depends
-def _collectAttributes(cls, new_attrs, look_for_class, delete=True,
- set_name=False):
+def _collectAttributes(cls, new_attrs, look_for_class):
+ """Finds all attributes in `new_attrs` that are instances of
+ `look_for_class`. The ``.name`` attribute is set for any matching objects.
+ Returns them as a list.
+
"""
- Finds all attributes in `new_attrs` that are instances of
- `look_for_class`. Returns them as a list. If `delete` is true
- they are also removed from the `cls`. If `set_name` is true, then
- the ``.name`` attribute is set for any matching objects.
- """
result = []
for attr, value in new_attrs.items():
if isinstance(value, look_for_class):
+ value.name = attr
+ delattr(cls, attr)
result.append(value)
- if set_name:
- value.name = attr
- if delete:
- delattr(cls, attr)
return result
class CreateNewSQLObject:
@@ -733,12 +729,9 @@
cls._SO_setupSqlmeta(new_attrs, is_base)
- implicitColumns = _collectAttributes(
- cls, new_attrs, col.Col, set_name=True)
- implicitJoins = _collectAttributes(
- cls, new_attrs, joins.Join, set_name=True)
- implicitIndexes = _collectAttributes(
- cls, new_attrs, index.DatabaseIndex, set_name=True)
+ implicitColumns = _collectAttributes(cls, new_attrs, col.Col)
+ implicitJoins = _collectAttributes(cls, new_attrs, joins.Join)
+ implicitIndexes = _collectAttributes(cls, new_attrs, index.DatabaseIndex)
if not is_base:
cls._SO_cleanDeprecatedAttrs(new_attrs)
|
|
From: <sub...@co...> - 2010-09-30 18:08:10
|
Author: phd
Date: 2010-09-30 11:37:57 -0600 (Thu, 30 Sep 2010)
New Revision: 4238
Modified:
SQLObject/trunk/sqlobject/main.py
Log:
Joins cannot be sorted because addJoin created accessors that remember indexes.
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-09-30 15:45:38 UTC (rev 4237)
+++ SQLObject/trunk/sqlobject/main.py 2010-09-30 17:37:57 UTC (rev 4238)
@@ -804,7 +804,9 @@
sqlmeta.columnList.sort(key=order_getter)
sqlmeta.indexes.sort(key=order_getter)
sqlmeta.indexDefinitions.sort(key=order_getter)
- sqlmeta.joins.sort(key=order_getter)
+ # Joins cannot be sorted because addJoin created accessors
+ # that remember indexes.
+ #sqlmeta.joins.sort(key=order_getter)
sqlmeta.joinDefinitions.sort(key=order_getter)
# We don't setup the properties until we're finished with the
|
|
From: <sub...@co...> - 2010-09-30 15:45:46
|
Author: phd
Date: 2010-09-30 09:45:38 -0600 (Thu, 30 Sep 2010)
New Revision: 4237
Modified:
SQLObject/trunk/sqlobject/col.py
Log:
Fixed a bug.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2010-09-22 17:47:58 UTC (rev 4236)
+++ SQLObject/trunk/sqlobject/col.py 2010-09-30 15:45:38 UTC (rev 4237)
@@ -197,7 +197,9 @@
if validator: _validators.append(validator)
if validator2: _validators.insert(0, validator2)
_vlen = len(_validators)
- if _vlen == 1:
+ if _vlen == 0:
+ self.validator = None # Set sef.{from,to}_python
+ elif _vlen == 1:
self.validator = _validators[0]
elif _vlen > 1:
self.validator = compound.All.join(_validators[0], *_validators[1:])
|
|
From: <sub...@co...> - 2010-09-22 17:48:05
|
Author: phd
Date: 2010-09-22 11:47:58 -0600 (Wed, 22 Sep 2010)
New Revision: 4236
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/tests/test_lazy.py
Log:
Major API change: attribute 'dirty' was moved to sqlmeta.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-09-14 09:51:23 UTC (rev 4235)
+++ SQLObject/trunk/docs/News.txt 2010-09-22 17:47:58 UTC (rev 4236)
@@ -24,6 +24,8 @@
value True; this means the default schema parser is now based on ``PRAGMA
table_info()``.
+* Major API change: attribute 'dirty' was moved to sqlmeta.
+
SQLObject 0.13.0
================
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-09-14 09:51:23 UTC (rev 4235)
+++ SQLObject/trunk/sqlobject/main.py 2010-09-22 17:47:58 UTC (rev 4236)
@@ -210,8 +210,6 @@
joins = []
joinDefinitions = []
- __metaclass__ = declarative.DeclarativeMeta
-
# These attributes shouldn't be shared with superclasses:
_unshared_attributes = ['table', 'columns', 'childName']
@@ -238,6 +236,11 @@
childClasses = {} # References to child classes, keyed by childName
childName = None # Class name for inheritance child object creation
+ # Does the row require syncing?
+ dirty = False
+
+ __metaclass__ = declarative.DeclarativeMeta
+
def __classinit__(cls, new_attrs):
for attr in cls._unshared_attributes:
if not new_attrs.has_key(attr):
@@ -900,7 +903,7 @@
cache.put(id, cls, val)
finally:
cache.finishPut(cls)
- elif selectResults and not val.dirty:
+ elif selectResults and not val.sqlmeta.dirty:
val._SO_writeLock.acquire()
try:
val._SO_selectInit(selectResults)
@@ -941,7 +944,7 @@
raise SQLObjectNotFound, "The object %s by the ID %s does not exist" % (self.__class__.__name__, self.id)
self._SO_selectInit(selectResults)
self._SO_createValues = {}
- self.dirty = False
+ self.sqlmeta.dirty = False
def _SO_loadValue(self, attrName):
try:
@@ -995,7 +998,7 @@
values = [(self.sqlmeta.columns[v[0]].dbName, v[1])
for v in self._SO_createValues.items()]
self._connection._SO_update(self, values)
- self.dirty = False
+ self.sqlmeta.dirty = False
self._SO_createValues = {}
finally:
self._SO_writeLock.release()
@@ -1045,7 +1048,7 @@
if to_python:
value = to_python(dbValue, self._SO_validatorState)
if self.sqlmeta._creating or self.sqlmeta.lazyUpdate:
- self.dirty = True
+ self.sqlmeta.dirty = True
self._SO_createValues[name] = dbValue
setattr(self, instanceName(name), value)
return
@@ -1104,7 +1107,7 @@
except AttributeError, e:
raise AttributeError, '%s (with attribute %r)' % (e, name)
- self.dirty = True
+ self.sqlmeta.dirty = True
return
self._SO_writeLock.acquire()
@@ -1287,7 +1290,7 @@
# Get rid of _SO_create*, we aren't creating anymore.
# Doesn't have to be threadsafe because we're still in
# new(), which doesn't need to be threadsafe.
- self.dirty = False
+ self.sqlmeta.dirty = False
if not self.sqlmeta.lazyUpdate:
del self._SO_createValues
else:
Modified: SQLObject/trunk/sqlobject/tests/test_lazy.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_lazy.py 2010-09-14 09:51:23 UTC (rev 4235)
+++ SQLObject/trunk/sqlobject/tests/test_lazy.py 2010-09-22 17:47:58 UTC (rev 4236)
@@ -43,50 +43,50 @@
# We just did an insert, but not an update:
assert not self.conn.didUpdate
obj.set(name='joe')
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert obj.name == 'joe'
assert not self.conn.didUpdate
obj.syncUpdate()
assert obj.name == 'joe'
assert self.conn.didUpdate
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
assert obj.name == 'joe'
self.conn.didUpdate = False
obj = Lazy(name='frank')
obj.name = 'joe'
assert not self.conn.didUpdate
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert obj.name == 'joe'
obj.name = 'joe2'
assert not self.conn.didUpdate
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert obj.name == 'joe2'
obj.syncUpdate()
assert obj.name == 'joe2'
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
assert self.conn.didUpdate
self.conn.didUpdate = False
obj = Lazy(name='loaded')
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
assert not self.conn.didUpdate
assert obj.name == 'loaded'
obj.name = 'unloaded'
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert obj.name == 'unloaded'
assert not self.conn.didUpdate
obj.sync()
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
assert obj.name == 'unloaded'
assert self.conn.didUpdate
self.conn.didUpdate = False
obj.name = 'whatever'
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert obj.name == 'whatever'
assert not self.conn.didUpdate
obj._SO_loadValue('name')
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert obj.name == 'whatever'
assert not self.conn.didUpdate
obj._SO_loadValue('other')
@@ -101,24 +101,24 @@
obj_id = obj.id
old_state = obj._SO_validatorState
obj = Lazy.get(obj_id)
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
assert not self.conn.didUpdate
assert obj._SO_validatorState is old_state
assert obj.name == 'whatever'
obj.name = 'unloaded'
assert obj.name == 'unloaded'
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert not self.conn.didUpdate
# Fetch the object again with get() and
- # make sure dirty is still set, as the
+ # make sure sqlmeta.dirty is still set, as the
# object should come from the cache.
obj = Lazy.get(obj_id)
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert not self.conn.didUpdate
assert obj.name == 'unloaded'
obj.syncUpdate()
assert self.conn.didUpdate
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
self.conn.didUpdate = False
# Then clear the cache, and try a get()
@@ -126,23 +126,23 @@
# is properly initialized.
self.conn.cache.clear()
obj = Lazy.get(obj_id)
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
assert not self.conn.didUpdate
assert obj.name == 'unloaded'
obj.name = 'spongebob'
assert obj.name == 'spongebob'
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert not self.conn.didUpdate
obj.syncUpdate()
assert self.conn.didUpdate
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
self.conn.didUpdate = False
obj = Lazy(name='last')
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
obj.syncUpdate()
assert not self.conn.didUpdate
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
# Check that setting multiple values
# actually works. This was broken
# and just worked because we were testing
@@ -155,8 +155,8 @@
assert obj.name == 'first'
assert obj.other == 'who'
assert obj.third == 'yes'
- assert obj.dirty
+ assert obj.sqlmeta.dirty
assert not self.conn.didUpdate
obj.syncUpdate()
assert self.conn.didUpdate
- assert not obj.dirty
+ assert not obj.sqlmeta.dirty
|
|
From: <sub...@co...> - 2010-09-14 09:51:30
|
Author: phd Date: 2010-09-14 03:51:23 -0600 (Tue, 14 Sep 2010) New Revision: 4235 Modified: SQLObject/trunk/docs/News.txt Log: Minor documentation update. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-09-13 16:23:36 UTC (rev 4234) +++ SQLObject/trunk/docs/News.txt 2010-09-14 09:51:23 UTC (rev 4235) @@ -16,14 +16,14 @@ * The lists of columns/indices/joins are now sorted according to the order of creation. -* validator2 was added to all columns; it is inserted at the beginning of - the list of validators, i.e. its ``from_python()`` method is called +* ``validator2`` was added to all columns; it is inserted at the beginning + of the list of validators, i.e. its ``from_python()`` method is called first, ``to_python()`` is called last, after all validators in the list. -* SQLiteConnection's parameter use_table_info became boolean with default - value True. +* SQLiteConnection's parameter ``use_table_info`` became boolean with default + value True; this means the default schema parser is now based on ``PRAGMA + table_info()``. - SQLObject 0.13.0 ================ |
|
From: <sub...@co...> - 2010-09-13 16:23:44
|
Author: phd
Date: 2010-09-13 10:23:36 -0600 (Mon, 13 Sep 2010)
New Revision: 4234
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Log:
SQLiteConnection's parameter use_table_info became boolean with default value True.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-08-31 16:48:57 UTC (rev 4233)
+++ SQLObject/trunk/docs/News.txt 2010-09-13 16:23:36 UTC (rev 4234)
@@ -20,6 +20,10 @@
the list of validators, i.e. its ``from_python()`` method is called
first, ``to_python()`` is called last, after all validators in the list.
+* SQLiteConnection's parameter use_table_info became boolean with default
+ value True.
+
+
SQLObject 0.13.0
================
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2010-08-31 16:48:57 UTC (rev 4233)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2010-09-13 16:23:36 UTC (rev 4234)
@@ -1,7 +1,7 @@
import base64
import os
import thread
-from sqlobject.dbconnection import DBAPI
+from sqlobject.dbconnection import DBAPI, Boolean
from sqlobject import col, sqlbuilder
from sqlobject.dberrors import *
@@ -73,7 +73,7 @@
factory = globals()[factory]
opts['factory'] = factory(sqlite)
else:
- opts['autocommit'] = bool(autoCommit)
+ opts['autocommit'] = Boolean(autoCommit)
if 'encoding' in kw:
opts['encoding'] = kw.pop('encoding')
if 'mode' in kw:
@@ -84,11 +84,11 @@
else:
opts['timeout'] = int(float(kw.pop('timeout')) * 1000)
if 'check_same_thread' in kw:
- opts["check_same_thread"] = bool(kw.pop('check_same_thread'))
+ opts["check_same_thread"] = Boolean(kw.pop('check_same_thread'))
# use only one connection for sqlite - supports multiple)
# cursors per connection
self._connOptions = opts
- self.use_table_info = kw.pop("use_table_info", False)
+ self.use_table_info = Boolean(kw.pop("use_table_info", True))
DBAPI.__init__(self, **kw)
self._threadPool = {}
self._threadOrigination = {}
|
|
From: <sub...@co...> - 2010-08-31 16:49:05
|
Author: phd
Date: 2010-08-31 10:48:57 -0600 (Tue, 31 Aug 2010)
New Revision: 4233
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/docs/SQLObject.txt
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/tests/test_validation.py
Log:
validator2 was added to all columns.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-08-31 15:51:36 UTC (rev 4232)
+++ SQLObject/trunk/docs/News.txt 2010-08-31 16:48:57 UTC (rev 4233)
@@ -16,6 +16,10 @@
* The lists of columns/indices/joins are now sorted according to the order
of creation.
+* validator2 was added to all columns; it is inserted at the beginning of
+ the list of validators, i.e. its ``from_python()`` method is called
+ first, ``to_python()`` is called last, after all validators in the list.
+
SQLObject 0.13.0
================
Modified: SQLObject/trunk/docs/SQLObject.txt
===================================================================
--- SQLObject/trunk/docs/SQLObject.txt 2010-08-31 15:51:36 UTC (rev 4232)
+++ SQLObject/trunk/docs/SQLObject.txt 2010-08-31 16:48:57 UTC (rev 4233)
@@ -1083,6 +1083,10 @@
the beginnig of the list to the end; ``to_python()`` in the reverse
order. That said, ``from_python()`` method of this validator is called
last, after all validators in the list; ``to_python()`` is called first.
+`validator2`:
+ Another validator. It is inserted in the beginning of the list of the
+ list of validators, i.e. its ``from_python()`` method is called first;
+ ``to_python()`` last.
.. _formencode: http://formencode.org/
.. _validator: http://formencode.org/Validator.html
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2010-08-31 15:51:36 UTC (rev 4232)
+++ SQLObject/trunk/sqlobject/col.py 2010-08-31 16:48:57 UTC (rev 4233)
@@ -97,6 +97,7 @@
sqlType=None,
columnDef=None,
validator=None,
+ validator2=None,
immutable=False,
cascade=None,
lazy=False,
@@ -193,11 +194,13 @@
self.alternateMethodName = alternateMethodName
_validators = self.createValidators()
- if _validators:
- if validator: _validators.append(validator)
+ if validator: _validators.append(validator)
+ if validator2: _validators.insert(0, validator2)
+ _vlen = len(_validators)
+ if _vlen == 1:
+ self.validator = _validators[0]
+ elif _vlen > 1:
self.validator = compound.All.join(_validators[0], *_validators[1:])
- else:
- self.validator = validator
self.noCache = noCache
self.lazy = lazy
# this is in case of ForeignKey, where we rename the column
Modified: SQLObject/trunk/sqlobject/tests/test_validation.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_validation.py 2010-08-31 15:51:36 UTC (rev 4232)
+++ SQLObject/trunk/sqlobject/tests/test_validation.py 2010-08-31 16:48:57 UTC (rev 4233)
@@ -6,6 +6,23 @@
## Validation/conversion
########################################
+class SOTestValidator(validators.Validator):
+ def to_python(self, value, state):
+ if value:
+ self.save_value.append(value)
+ return 1
+ return value
+
+ def from_python(self, value, state):
+ if value:
+ self.save_value.append(value)
+ return 2
+ return value
+
+validator1 = SOTestValidator(save_value=[])
+validator2 = SOTestValidator(save_value=[])
+
+
class SOValidation(SQLObject):
name = StringCol(validator=validators.PlainText(),
@@ -17,6 +34,7 @@
name6 = BoolCol(default=None)
name7 = UnicodeCol(default=None)
name8 = IntCol(default=None)
+ name9 = IntCol(validator=validator1, validator2=validator2, default=0)
class SOValidationTest(object):
def __init__(self, value):
@@ -78,3 +96,9 @@
def test_emptyValue(self):
t = SOValidation(name5={})
assert t.name5 == {}
+
+ def test_validator2(self):
+ t = SOValidation(name9=1)
+ t = SOValidation(name9=2)
+ assert validator1.save_value == [2, 2, 2, 2, 2, 2]
+ assert validator2.save_value == [1, 1, 1, 2, 1, 1]
|
|
From: <sub...@co...> - 2010-08-31 15:51:43
|
Author: phd
Date: 2010-08-31 09:51:36 -0600 (Tue, 31 Aug 2010)
New Revision: 4232
Modified:
SQLObject/trunk/docs/SQLObject.txt
Log:
Explained the order of method calls for a list of validators.
Modified: SQLObject/trunk/docs/SQLObject.txt
===================================================================
--- SQLObject/trunk/docs/SQLObject.txt 2010-08-16 15:05:48 UTC (rev 4231)
+++ SQLObject/trunk/docs/SQLObject.txt 2010-08-31 15:51:36 UTC (rev 4232)
@@ -1077,7 +1077,12 @@
an object that provides ``to_python()`` and ``from_python()``
to validate *and* convert (adapt or cast) the values when they are
read/written from/to the database. You should see formencode_
- validator_ documentation for more details.
+ validator_ documentation for more details. This validator is appended
+ to the end of the list of the list of column validators. If the column
+ has a list of validators their ``from_python()`` methods are ran from
+ the beginnig of the list to the end; ``to_python()`` in the reverse
+ order. That said, ``from_python()`` method of this validator is called
+ last, after all validators in the list; ``to_python()`` is called first.
.. _formencode: http://formencode.org/
.. _validator: http://formencode.org/Validator.html
|
|
From: SourceForge.net <no...@so...> - 2010-08-20 20:01:26
|
Bugs item #2865410, was opened at 2009-09-24 00:45 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2865410&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: None Group: SQLObject release (specify) Status: Closed Resolution: Invalid Priority: 5 Private: No Submitted By: Brendan Doms (bdoms) Assigned to: Oleg Broytman (phd) Summary: createTable Fails When Table is Named "Transaction" Initial Comment: Bare bones, just try this (I'm working off of the easy_install version on Ubuntu, which is currently 0.11.0): from sqlobject import SQLObject, connectionForURI, sqlhub db_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'finance.db') connection = connectionForURI('sqlite:' + db_file) sqlhub.processConnection = connection class Transaction(SQLObject): pass Transaction.createTable() If the table is named anything else (as far as I can find), then it works fine. But as it is, this generates the following error: File "/usr/local/lib/python2.6/dist-packages/SQLObject-0.11.0-py2.6.egg/sqlobject/sqlite/sqliteconnection.py", line 183, in _executeRetry raise OperationalError(ErrorMessage(e)) sqlobject.dberrors.OperationalError: near "transaction": syntax error Not very helpful right? Either this error should be changed to point out the fact that "Transaction" is invalid as a table name, or the preferred solution would be to eliminate the error altogether and allow this table name. Considering that the import list contains no * and nothing called "Transaction" I see no reason why SQLObject's name space should interfere here. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2010-08-20 20:01 Message: De1WzH <a href="http://uglzxytevdew.com/">uglzxytevdew</a>, [url=http://jogkhjvogceu.com/]jogkhjvogceu[/url], [link=http://ccbswjtpbxdj.com/]ccbswjtpbxdj[/link], http://ixwkolywqmry.com/ ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2010-04-25 21:24 Message: jakmak, you can do this in SQLite, but you will have problems later dealing with in in SQLObject. ---------------------------------------------------------------------- Comment By: jakimak (jakmak) Date: 2010-04-25 21:05 Message: just came accross this. Using sqlite3, you can simply put the keyword into quotes, then it works fine. This could also apply for SQLObject, but didn't test it. e.g. CREATE TABLE "transaction" (id INTEGER PRIMARY KEY); or CREATE TABLE "transaction" ("transaction" INTEGER PRIMARY KEY); and DROP TABLE "transaction"; ---------------------------------------------------------------------- Comment By: Brendan Doms (bdoms) Date: 2009-09-25 21:25 Message: Ah, nice job getting to the root of the issue. I guess I just assumed that because SQLObject is an abstraction layer it would take the pain away from dealing with databases and so none of SQLite's (or any other database) reserved keywords would be in conflict. My bad. Since that's not the case, I would still recommend making the error message more clear here if possible. Specifically mentioning the reserved keyword thing would have helped me track down the bug faster. ---------------------------------------------------------------------- Comment By: Oleg Broytman (phd) Date: 2009-09-25 15:04 Message: If you add '?debug=1' to DB URI you find the following SQLObject debugging output: 1/QueryR : CREATE TABLE transaction ( id INTEGER PRIMARY KEY ) This is where the error came from - from SQLite, not from SQLObject! SQLObject's namespace has nothing to do here. Traceback (most recent call last): [skip] raise OperationalError(ErrorMessage(e)) sqlobject.dberrors.OperationalError: near "transaction": syntax error Let's test it without SQLObject: $ sqlite3 test SQLite version 3.5.9 Enter ".help" for instructions sqlite> CREATE TABLE transaction (id INTEGER PRIMARY KEY); SQL error: near "transaction": syntax error SQLite (like any other DB) doesn't allow keywords to be used as names. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2865410&group_id=74338 |
|
From: <sub...@co...> - 2010-08-16 15:05:58
|
Author: phd
Date: 2010-08-16 09:05:48 -0600 (Mon, 16 Aug 2010)
New Revision: 4231
Modified:
SQLObject/trunk/sqlobject/joins.py
Log:
Stupid me... get the next value from the counter...
Modified: SQLObject/trunk/sqlobject/joins.py
===================================================================
--- SQLObject/trunk/sqlobject/joins.py 2010-08-16 14:45:05 UTC (rev 4230)
+++ SQLObject/trunk/sqlobject/joins.py 2010-08-16 15:05:48 UTC (rev 4231)
@@ -22,7 +22,7 @@
kw['otherClass'] = otherClass
self.kw = kw
self._joinMethodName = self.kw.pop('joinMethodName', None)
- self.creationOrder = self.kw.pop('creationOrder', None)
+ self.creationOrder = creationOrder.next()
def _set_joinMethodName(self, value):
assert self._joinMethodName == value or self._joinMethodName is None, "You have already given an explicit joinMethodName (%s), and you are now setting it to %s" % (self._joinMethodName, value)
|
|
From: <sub...@co...> - 2010-08-16 14:45:16
|
Author: phd
Date: 2010-08-16 08:45:05 -0600 (Mon, 16 Aug 2010)
New Revision: 4230
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/index.py
SQLObject/trunk/sqlobject/joins.py
SQLObject/trunk/sqlobject/main.py
Log:
The lists of columns/indices/joins are now sorted according to the order of creation.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-08-11 14:40:49 UTC (rev 4229)
+++ SQLObject/trunk/docs/News.txt 2010-08-16 14:45:05 UTC (rev 4230)
@@ -10,6 +10,12 @@
SQLObject (trunk)
=================
+Features & Interface
+--------------------
+
+* The lists of columns/indices/joins are now sorted according to the order
+ of creation.
+
SQLObject 0.13.0
================
Modified: SQLObject/trunk/sqlobject/index.py
===================================================================
--- SQLObject/trunk/sqlobject/index.py 2010-08-11 14:40:49 UTC (rev 4229)
+++ SQLObject/trunk/sqlobject/index.py 2010-08-16 14:45:05 UTC (rev 4230)
@@ -1,16 +1,21 @@
+from itertools import count
from types import *
from converters import sqlrepr
+creationOrder = count()
+
class SODatabaseIndex(object):
def __init__(self,
soClass,
name,
columns,
+ creationOrder,
unique=False):
self.soClass = soClass
self.name = name
self.descriptions = self.convertColumns(columns)
+ self.creationOrder = creationOrder
self.unique = unique
def get(self, *args, **kw):
@@ -33,7 +38,7 @@
kw[columns[i].foreignName] = args[i]
else:
kw[columns[i].name] = args[i]
- return self.soClass.selectBy(connection=connection, **kw).getOne()
+ return self.soClass.selectBy(connection=connection, **kw).getOne()
def convertColumns(self, columns):
"""
@@ -148,6 +153,7 @@
def __init__(self, *columns, **kw):
kw['columns'] = columns
self.kw = kw
+ self.creationOrder = creationOrder.next()
def setName(self, value):
assert self.kw.get('name') is None, "You cannot change a name after it has already been set (from %s to %s)" % (self.kw['name'], value)
@@ -162,7 +168,8 @@
name = property(_get_name, _set_name)
def withClass(self, soClass):
- return self.baseClass(soClass=soClass, **self.kw)
+ return self.baseClass(soClass=soClass,
+ creationOrder=self.creationOrder, **self.kw)
def __repr__(self):
return '<%s %s %s>' % (
Modified: SQLObject/trunk/sqlobject/joins.py
===================================================================
--- SQLObject/trunk/sqlobject/joins.py 2010-08-11 14:40:49 UTC (rev 4229)
+++ SQLObject/trunk/sqlobject/joins.py 2010-08-16 14:45:05 UTC (rev 4230)
@@ -1,12 +1,15 @@
-import sqlbuilder
-NoDefault = sqlbuilder.NoDefault
-import styles
+from itertools import count
import classregistry
import events
+import styles
+import sqlbuilder
__all__ = ['MultipleJoin', 'SQLMultipleJoin', 'RelatedJoin', 'SQLRelatedJoin',
'SingleJoin', 'ManyToMany', 'OneToMany']
+creationOrder = count()
+NoDefault = sqlbuilder.NoDefault
+
def getID(obj):
try:
return obj.id
@@ -19,6 +22,7 @@
kw['otherClass'] = otherClass
self.kw = kw
self._joinMethodName = self.kw.pop('joinMethodName', None)
+ self.creationOrder = self.kw.pop('creationOrder', None)
def _set_joinMethodName(self, value):
assert self._joinMethodName == value or self._joinMethodName is None, "You have already given an explicit joinMethodName (%s), and you are now setting it to %s" % (self._joinMethodName, value)
@@ -34,7 +38,8 @@
if self.kw.has_key('joinMethodName'):
self._joinMethodName = self.kw['joinMethodName']
del self.kw['joinMethodName']
- return self.baseClass(soClass=soClass,
+ return self.baseClass(creationOrder=self.creationOrder,
+ soClass=soClass,
joinDef=self,
joinMethodName=self._joinMethodName,
**self.kw)
@@ -45,12 +50,14 @@
class SOJoin(object):
def __init__(self,
+ creationOrder,
soClass=None,
otherClass=None,
joinColumn=None,
joinMethodName=None,
orderBy=NoDefault,
joinDef=None):
+ self.creationOrder = creationOrder
self.soClass = soClass
self.joinDef = joinDef
self.otherClassName = otherClass
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-08-11 14:40:49 UTC (rev 4229)
+++ SQLObject/trunk/sqlobject/main.py 2010-08-16 14:45:05 UTC (rev 4230)
@@ -144,13 +144,12 @@
return depends
def _collectAttributes(cls, new_attrs, look_for_class, delete=True,
- set_name=False, sort=False):
+ set_name=False):
"""
Finds all attributes in `new_attrs` that are instances of
`look_for_class`. Returns them as a list. If `delete` is true
they are also removed from the `cls`. If `set_name` is true, then
- the ``.name`` attribute is set for any matching objects. If
- `sort` is true, then they will be sorted by ``obj.creationOrder``.
+ the ``.name`` attribute is set for any matching objects.
"""
result = []
for attr, value in new_attrs.items():
@@ -160,9 +159,6 @@
value.name = attr
if delete:
delattr(cls, attr)
- if sort:
- result.sort(
- lambda a, b: cmp(a.creationOrder, b.creationOrder))
return result
class CreateNewSQLObject:
@@ -209,9 +205,9 @@
columnDefinitions = {}
# These are lists of the join and index objects:
- joins = []
indexes = []
indexDefinitions = []
+ joins = []
joinDefinitions = []
__metaclass__ = declarative.DeclarativeMeta
@@ -735,7 +731,7 @@
cls._SO_setupSqlmeta(new_attrs, is_base)
implicitColumns = _collectAttributes(
- cls, new_attrs, col.Col, set_name=True, sort=True)
+ cls, new_attrs, col.Col, set_name=True)
implicitJoins = _collectAttributes(
cls, new_attrs, joins.Join, set_name=True)
implicitIndexes = _collectAttributes(
@@ -772,33 +768,42 @@
if connection and ('_connection' not in cls.__dict__):
cls.setConnection(connection)
+ sqlmeta = cls.sqlmeta
+
# We have to check if there are columns in the inherited
# _columns where the attribute has been set to None in this
# class. If so, then we need to remove that column from
# _columns.
- for key in cls.sqlmeta.columnDefinitions.keys():
+ for key in sqlmeta.columnDefinitions.keys():
if (key in new_attrs
and new_attrs[key] is None):
- del cls.sqlmeta.columnDefinitions[key]
+ del sqlmeta.columnDefinitions[key]
- for column in cls.sqlmeta.columnDefinitions.values():
- cls.sqlmeta.addColumn(column)
+ for column in sqlmeta.columnDefinitions.values():
+ sqlmeta.addColumn(column)
for column in implicitColumns:
- cls.sqlmeta.addColumn(column)
+ sqlmeta.addColumn(column)
# Now the class is in an essentially OK-state, so we can
# set up any magic attributes:
declarative.setup_attributes(cls, new_attrs)
- if cls.sqlmeta.fromDatabase:
- cls.sqlmeta.addColumnsFromDatabase()
+ if sqlmeta.fromDatabase:
+ sqlmeta.addColumnsFromDatabase()
for j in implicitJoins:
- cls.sqlmeta.addJoin(j)
+ sqlmeta.addJoin(j)
for i in implicitIndexes:
- cls.sqlmeta.addIndex(i)
+ sqlmeta.addIndex(i)
+ order_getter = lambda o: o.creationOrder
+ sqlmeta.columnList.sort(key=order_getter)
+ sqlmeta.indexes.sort(key=order_getter)
+ sqlmeta.indexDefinitions.sort(key=order_getter)
+ sqlmeta.joins.sort(key=order_getter)
+ sqlmeta.joinDefinitions.sort(key=order_getter)
+
# We don't setup the properties until we're finished with the
# batch adding of all the columns...
cls._notifyFinishClassCreation()
@@ -812,7 +817,7 @@
cls.q = sqlbuilder.SQLObjectTable(cls)
cls.j = sqlbuilder.SQLObjectTableWithJoins(cls)
- classregistry.registry(cls.sqlmeta.registry).addClass(cls)
+ classregistry.registry(sqlmeta.registry).addClass(cls)
# @classmethod
def _SO_setupSqlmeta(cls, new_attrs, is_base):
|
|
From: <sub...@co...> - 2010-08-11 14:40:55
|
Author: phd Date: 2010-08-11 08:40:49 -0600 (Wed, 11 Aug 2010) New Revision: 4229 Added: SQLObject/tags/0.13.0/ Log: Tagging 0.13.0 Copied: SQLObject/tags/0.13.0 (from rev 4228, SQLObject/branches/0.13) |
|
From: <sub...@co...> - 2010-08-11 14:40:12
|
Author: phd Date: 2010-08-11 08:40:02 -0600 (Wed, 11 Aug 2010) New Revision: 4228 Modified: SQLObject/trunk/docs/News.txt Log: SQLObject 0.13.0 was released 11 Aug 2010. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-08-11 14:33:27 UTC (rev 4227) +++ SQLObject/trunk/docs/News.txt 2010-08-11 14:40:02 UTC (rev 4228) @@ -13,6 +13,8 @@ SQLObject 0.13.0 ================ +Released 11 Aug 2010. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2010-08-11 14:33:39
|
Author: phd Date: 2010-08-11 08:33:27 -0600 (Wed, 11 Aug 2010) New Revision: 4227 Modified: SQLObject/branches/0.13/docs/News.txt Log: SQLObject 0.13.0 was released 11 Aug 2010. Modified: SQLObject/branches/0.13/docs/News.txt =================================================================== --- SQLObject/branches/0.13/docs/News.txt 2010-08-10 05:37:51 UTC (rev 4226) +++ SQLObject/branches/0.13/docs/News.txt 2010-08-11 14:33:27 UTC (rev 4227) @@ -10,6 +10,8 @@ SQLObject 0.13.0 ================ +Released 11 Aug 2010. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2010-07-30 17:35:12
|
Author: phd
Date: 2010-07-30 11:35:06 -0600 (Fri, 30 Jul 2010)
New Revision: 4225
Modified:
SQLObject/tags/0.13.0b2/setup.py
SQLObject/tags/0.13.0b2/sqlobject/__init__.py
SQLObject/tags/0.13.0b2/sqlobject/main.py
Log:
Version 0.13.0b2.
Modified: SQLObject/tags/0.13.0b2/setup.py
===================================================================
--- SQLObject/tags/0.13.0b2/setup.py 2010-07-30 17:32:59 UTC (rev 4224)
+++ SQLObject/tags/0.13.0b2/setup.py 2010-07-30 17:35:06 UTC (rev 4225)
@@ -21,7 +21,7 @@
"""
setup(name="SQLObject",
- version="0.13",
+ version="0.13.0b2",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
@@ -49,7 +49,7 @@
author="Ian Bicking",
author_email="ia...@co...",
url="http://sqlobject.org/devel/",
- download_url="http://cheeseshop.python.org/pypi/SQLObject/0.13",
+ download_url="http://cheeseshop.python.org/pypi/SQLObject/0.13.0b2",
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin"],
Modified: SQLObject/tags/0.13.0b2/sqlobject/__init__.py
===================================================================
--- SQLObject/tags/0.13.0b2/sqlobject/__init__.py 2010-07-30 17:32:59 UTC (rev 4224)
+++ SQLObject/tags/0.13.0b2/sqlobject/__init__.py 2010-07-30 17:35:06 UTC (rev 4225)
@@ -1,5 +1,5 @@
"""
-SQLObject 0.13
+SQLObject 0.13.0b2
"""
from col import *
Modified: SQLObject/tags/0.13.0b2/sqlobject/main.py
===================================================================
--- SQLObject/tags/0.13.0b2/sqlobject/main.py 2010-07-30 17:32:59 UTC (rev 4224)
+++ SQLObject/tags/0.13.0b2/sqlobject/main.py 2010-07-30 17:35:06 UTC (rev 4225)
@@ -1,6 +1,6 @@
"""
-SQLObject 0.13
---------------
+SQLObject 0.13.0b2
+------------------
:author: Ian Bicking <ia...@co...>
|
|
From: <sub...@co...> - 2010-07-30 17:33:07
|
Author: phd Date: 2010-07-30 11:32:59 -0600 (Fri, 30 Jul 2010) New Revision: 4224 Added: SQLObject/tags/0.13.0b2/ Log: Tagging 0.13.0b2 Copied: SQLObject/tags/0.13.0b2 (from rev 4223, SQLObject/branches/0.13) |
|
From: <sub...@co...> - 2010-07-30 10:08:15
|
Author: phd
Date: 2010-07-30 03:43:10 -0600 (Fri, 30 Jul 2010)
New Revision: 4223
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/col.py
Log:
Merged revision 4222 from branch 0.13: removed SQLValidator - its attemptConvert
was never called because in FormEncode it's named attempt_convert.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-07-30 09:40:44 UTC (rev 4222)
+++ SQLObject/trunk/docs/News.txt 2010-07-30 09:43:10 UTC (rev 4223)
@@ -47,6 +47,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/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2010-07-30 09:40:44 UTC (rev 4222)
+++ SQLObject/trunk/sqlobject/col.py 2010-07-30 09:43:10 UTC (rev 4223)
@@ -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
|