sqlobject-cvs Mailing List for SQLObject (Page 80)
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
(2) |
|
From: <sub...@co...> - 2007-09-26 21:19:39
|
Author: phd
Date: 2007-09-26 15:19:34 -0600 (Wed, 26 Sep 2007)
New Revision: 3003
Modified:
SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py
Log:
Backported the patch from r2986 from the trunk.
Modified: SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py 2007-09-26 21:18:52 UTC (rev 3002)
+++ SQLObject/branches/0.7/sqlobject/mysql/mysqlconnection.py 2007-09-26 21:19:34 UTC (rev 3003)
@@ -89,7 +89,10 @@
# For MySQLdb 1.2.1 and later, we go
# encoding->unicode->charset (in the mysql db)
if self.need_unicode and not isinstance(query, unicode):
- query = unicode(query, self.encoding)
+ try:
+ query = unicode(query, self.encoding)
+ except UnicodeError:
+ pass
return cursor.execute(query)
except MySQLdb.OperationalError, e:
if e.args[0] == 2013: # SERVER_LOST error
|
|
From: <sub...@co...> - 2007-09-26 21:18:58
|
Author: novalis
Date: 2007-09-26 15:18:52 -0600 (Wed, 26 Sep 2007)
New Revision: 3002
Modified:
SQLObject/trunk/sqlobject/tests/test_unicode.py
Log:
in mysql, altids must have length
Modified: SQLObject/trunk/sqlobject/tests/test_unicode.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_unicode.py 2007-09-26 21:11:03 UTC (rev 3001)
+++ SQLObject/trunk/sqlobject/tests/test_unicode.py 2007-09-26 21:18:52 UTC (rev 3002)
@@ -7,7 +7,7 @@
class TestUnicode(SQLObject):
count = IntCol(alternateID=True)
- col1 = UnicodeCol(alternateID=True)
+ col1 = UnicodeCol(alternateID=True, length=100)
col2 = UnicodeCol(dbEncoding='latin-1')
data = [u'\u00f0', u'test', 'ascii test']
|
|
From: <sub...@co...> - 2007-09-26 21:11:09
|
Author: novalis Date: 2007-09-26 15:11:03 -0600 (Wed, 26 Sep 2007) New Revision: 3001 Removed: SQLObject/trunk/sqlobject/mysql/tests/ Log: these tests were duplicative |
|
From: <sub...@co...> - 2007-09-26 20:41:29
|
Author: phd
Date: 2007-09-26 14:41:14 -0600 (Wed, 26 Sep 2007)
New Revision: 3000
Modified:
SQLObject/trunk/sqlobject/main.py
Log:
Do not send a second signal (after .set() calls ._SO_setValue()).
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2007-09-26 20:41:02 UTC (rev 2999)
+++ SQLObject/trunk/sqlobject/main.py 2007-09-26 20:41:14 UTC (rev 3000)
@@ -1041,7 +1041,7 @@
# the parts are set. So we just keep them in a
# dictionary until later:
d = {name: value}
- if not self.sqlmeta._creating:
+ if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False):
self.sqlmeta.send(events.RowUpdateSignal, self, d)
if len(d) != 1 or name not in d:
# Already called RowUpdateSignal, don't call it again
|
|
From: <sub...@co...> - 2007-09-26 20:41:09
|
Author: phd
Date: 2007-09-26 14:41:02 -0600 (Wed, 26 Sep 2007)
New Revision: 2999
Modified:
SQLObject/branches/0.9/sqlobject/main.py
Log:
Do not send a second signal (after .set() calls ._SO_setValue()).
Modified: SQLObject/branches/0.9/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.9/sqlobject/main.py 2007-09-26 20:40:16 UTC (rev 2998)
+++ SQLObject/branches/0.9/sqlobject/main.py 2007-09-26 20:41:02 UTC (rev 2999)
@@ -1041,7 +1041,7 @@
# the parts are set. So we just keep them in a
# dictionary until later:
d = {name: value}
- if not self.sqlmeta._creating:
+ if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False):
self.sqlmeta.send(events.RowUpdateSignal, self, d)
if len(d) != 1 or name not in d:
# Already called RowUpdateSignal, don't call it again
|
|
From: <sub...@co...> - 2007-09-26 20:40:26
|
Author: phd
Date: 2007-09-26 14:40:16 -0600 (Wed, 26 Sep 2007)
New Revision: 2998
Modified:
SQLObject/branches/0.8/sqlobject/main.py
Log:
Do not send a second signal (after .set() calls ._SO_setValue()).
Modified: SQLObject/branches/0.8/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/main.py 2007-09-26 19:43:04 UTC (rev 2997)
+++ SQLObject/branches/0.8/sqlobject/main.py 2007-09-26 20:40:16 UTC (rev 2998)
@@ -1058,7 +1058,7 @@
# the parts are set. So we just keep them in a
# dictionary until later:
d = {name: value}
- if not self.sqlmeta._creating:
+ if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False):
self.sqlmeta.send(events.RowUpdateSignal, self, d)
if len(d) != 1 or name not in d:
# Already called RowUpdateSignal, don't call it again
|
|
From: <sub...@co...> - 2007-09-26 19:43:08
|
Author: novalis
Date: 2007-09-26 13:43:04 -0600 (Wed, 26 Sep 2007)
New Revision: 2997
Modified:
SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py
Log:
check that values roundtrip in unicode
Modified: SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py 2007-09-26 19:41:09 UTC (rev 2996)
+++ SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py 2007-09-26 19:43:04 UTC (rev 2997)
@@ -29,5 +29,11 @@
#test string that contain non-plain-text
#note: unicode column should be in unicode.
#blob column should be text.
- MyTable(strc="", unic=u"\x82", bloc="\x82")
+ MyTable(strc="unic", unic=u"\x82", bloc="\x82")
+ m = MyTable.selectBy(strc='unic')
+ m = m[0]
+ assert m.bloc == "\x82"
+ assert m.unic == u"\x82"
+
+
|
|
From: <sub...@co...> - 2007-09-26 19:41:15
|
Author: novalis
Date: 2007-09-26 13:41:09 -0600 (Wed, 26 Sep 2007)
New Revision: 2996
Added:
SQLObject/trunk/sqlobject/mysql/tests/
SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py
Log:
test for mysql unicode and blobs
Added: SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py (rev 0)
+++ SQLObject/trunk/sqlobject/mysql/tests/test_unicode.py 2007-09-26 19:41:09 UTC (rev 2996)
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+from py.test import raises
+
+from sqlobject import *
+
+sqlhub.processConnection = connectionForURI('mysql://nz:newzed@localhost/nz')
+
+from sqlobject.tests.dbtest import *
+
+class MyTable(SQLObject):
+ strc = StringCol()
+ unic = UnicodeCol()
+ bloc = BLOBCol()
+
+
+
+def test_unicode():
+
+ #MyTable.dropTable(ifExists=True)
+ MyTable.createTable(ifNotExists=True)
+
+ #test plain text
+ MyTable(strc="plain", unic="text", bloc="col")
+
+ #test unicode objects that are plain text
+ MyTable(strc=u"plain", unic=u"text", bloc="col")
+
+ #test string that contain non-plain-text
+ #note: unicode column should be in unicode.
+ #blob column should be text.
+ MyTable(strc="", unic=u"\x82", bloc="\x82")
+
|
|
From: <sub...@co...> - 2007-09-26 17:45:07
|
Author: phd Date: 2007-09-26 11:44:57 -0600 (Wed, 26 Sep 2007) New Revision: 2995 Modified: SQLObject/docs/News.txt Log: Removed SelectResults.__nonzero__, which was a design mistake. See the thread http://mail.python.org/pipermail/python-dev/2007-September/074731.html Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2007-09-26 17:43:47 UTC (rev 2994) +++ SQLObject/docs/News.txt 2007-09-26 17:44:57 UTC (rev 2995) @@ -56,7 +56,7 @@ * Fixed a bug in Versioning - do not copy "alternateID" and "unique" attributes from the versioned table. -* A number of changes ported from `SQLObject 0.7.9`_. +* A number of changes ported from `SQLObject 0.7.9`_ and `SQLObject 0.8.6`_. SQLObject 0.9.1 =============== @@ -128,6 +128,10 @@ SQLObject 0.8.6 =============== +* Removed SelectResults.__nonzero__, which was a design mistake. Raising an + exception in __nonzero__() is inconsistent with other iterators + (bool(iter([])) => True). + * A number of changes ported from `SQLObject 0.7.9`_. SQLObject 0.8.5 |
|
From: <sub...@co...> - 2007-09-26 17:43:52
|
Author: phd Date: 2007-09-26 11:43:47 -0600 (Wed, 26 Sep 2007) New Revision: 2994 Modified: SQLObject/trunk/sqlobject/sresults.py SQLObject/trunk/sqlobject/tests/test_select.py Log: Removed SelectResults.__nonzero__, which was a design mistake. See the thread http://mail.python.org/pipermail/python-dev/2007-September/074731.html Modified: SQLObject/trunk/sqlobject/sresults.py =================================================================== --- SQLObject/trunk/sqlobject/sresults.py 2007-09-26 17:43:00 UTC (rev 2993) +++ SQLObject/trunk/sqlobject/sresults.py 2007-09-26 17:43:47 UTC (rev 2994) @@ -57,10 +57,6 @@ def __repr__(self): return "<%s at %x>" % (self.__class__.__name__, id(self)) - def __nonzero__(self): - raise NotImplementedError( - "To test if a SelectResult will produce any items, use list(result) or result.count()") - def _getConnection(self): return self.ops.get('connection') or self.sourceClass._connection Modified: SQLObject/trunk/sqlobject/tests/test_select.py =================================================================== --- SQLObject/trunk/sqlobject/tests/test_select.py 2007-09-26 17:43:00 UTC (rev 2993) +++ SQLObject/trunk/sqlobject/tests/test_select.py 2007-09-26 17:43:47 UTC (rev 2994) @@ -166,8 +166,3 @@ assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1 assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1 assert IterTest.select(RLIKE(IterTest.q.name, "^sqlx.*$")).count() == 0 - -def test_bool_SelectResults(): - setupClass(IterTest) - - raises(NotImplementedError, bool, IterTest.select()) |
|
From: <sub...@co...> - 2007-09-26 17:43:08
|
Author: phd Date: 2007-09-26 11:43:00 -0600 (Wed, 26 Sep 2007) New Revision: 2993 Modified: SQLObject/branches/0.9/docs/News.txt SQLObject/branches/0.9/sqlobject/sresults.py SQLObject/branches/0.9/sqlobject/tests/test_select.py Log: Removed SelectResults.__nonzero__, which was a design mistake. See the thread http://mail.python.org/pipermail/python-dev/2007-September/074731.html Modified: SQLObject/branches/0.9/docs/News.txt =================================================================== --- SQLObject/branches/0.9/docs/News.txt 2007-09-26 17:41:47 UTC (rev 2992) +++ SQLObject/branches/0.9/docs/News.txt 2007-09-26 17:43:00 UTC (rev 2993) @@ -13,7 +13,7 @@ * Fixed a bug in Versioning - do not copy "alternateID" and "unique" attributes from the versioned table. -* A number of changes ported from `SQLObject 0.7.9`_. +* A number of changes ported from `SQLObject 0.7.9`_ and `SQLObject 0.8.6`_. SQLObject 0.9.1 =============== @@ -87,6 +87,10 @@ SQLObject 0.8.6 =============== +* Removed SelectResults.__nonzero__, which was a design mistake. Raising an + exception in __nonzero__() is inconsistent with other iterators + (bool(iter([])) => True). + * A number of changes ported from `SQLObject 0.7.9`_. SQLObject 0.8.5 Modified: SQLObject/branches/0.9/sqlobject/sresults.py =================================================================== --- SQLObject/branches/0.9/sqlobject/sresults.py 2007-09-26 17:41:47 UTC (rev 2992) +++ SQLObject/branches/0.9/sqlobject/sresults.py 2007-09-26 17:43:00 UTC (rev 2993) @@ -41,10 +41,6 @@ def __repr__(self): return "<%s at %x>" % (self.__class__.__name__, id(self)) - def __nonzero__(self): - raise NotImplementedError( - "To test if a SelectResult will produce any items, use list(result) or result.count()") - def _getConnection(self): return self.ops.get('connection') or self.sourceClass._connection Modified: SQLObject/branches/0.9/sqlobject/tests/test_select.py =================================================================== --- SQLObject/branches/0.9/sqlobject/tests/test_select.py 2007-09-26 17:41:47 UTC (rev 2992) +++ SQLObject/branches/0.9/sqlobject/tests/test_select.py 2007-09-26 17:43:00 UTC (rev 2993) @@ -184,8 +184,3 @@ assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1 assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1 assert IterTest.select(RLIKE(IterTest.q.name, "^sqlx.*$")).count() == 0 - -def test_bool_SelectResults(): - setupClass(IterTest) - - raises(NotImplementedError, bool, IterTest.select()) |
|
From: <sub...@co...> - 2007-09-26 17:41:52
|
Author: phd Date: 2007-09-26 11:41:47 -0600 (Wed, 26 Sep 2007) New Revision: 2992 Modified: SQLObject/branches/0.8/docs/News.txt SQLObject/branches/0.8/sqlobject/sresults.py SQLObject/branches/0.8/sqlobject/tests/test_select.py Log: Removed SelectResults.__nonzero__, which was a design mistake. See the thread http://mail.python.org/pipermail/python-dev/2007-September/074731.html Modified: SQLObject/branches/0.8/docs/News.txt =================================================================== --- SQLObject/branches/0.8/docs/News.txt 2007-09-26 14:32:11 UTC (rev 2991) +++ SQLObject/branches/0.8/docs/News.txt 2007-09-26 17:41:47 UTC (rev 2992) @@ -10,6 +10,10 @@ SQLObject 0.8.6 =============== +* Removed SelectResults.__nonzero__, which was a design mistake. Raising an + exception in __nonzero__() is inconsistent with other iterators + (bool(iter([])) => True). + * A number of changes ported from `SQLObject 0.7.9`_. SQLObject 0.8.5 Modified: SQLObject/branches/0.8/sqlobject/sresults.py =================================================================== --- SQLObject/branches/0.8/sqlobject/sresults.py 2007-09-26 14:32:11 UTC (rev 2991) +++ SQLObject/branches/0.8/sqlobject/sresults.py 2007-09-26 17:41:47 UTC (rev 2992) @@ -41,10 +41,6 @@ def __repr__(self): return "<%s at %x>" % (self.__class__.__name__, id(self)) - def __nonzero__(self): - raise NotImplementedError( - "To test if a SelectResult will produce any items, use list(result) or result.count()") - def _getConnection(self): return self.ops.get('connection') or self.sourceClass._connection Modified: SQLObject/branches/0.8/sqlobject/tests/test_select.py =================================================================== --- SQLObject/branches/0.8/sqlobject/tests/test_select.py 2007-09-26 14:32:11 UTC (rev 2991) +++ SQLObject/branches/0.8/sqlobject/tests/test_select.py 2007-09-26 17:41:47 UTC (rev 2992) @@ -184,8 +184,3 @@ assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1 assert IterTest.select(RLIKE(IterTest.q.name, "^sqlb.*$")).count() == 1 assert IterTest.select(RLIKE(IterTest.q.name, "^sqlx.*$")).count() == 0 - -def test_bool_SelectResults(): - setupClass(IterTest) - - raises(NotImplementedError, bool, IterTest.select()) |
|
From: <sub...@co...> - 2007-09-26 14:32:19
|
Author: phd Date: 2007-09-26 08:32:11 -0600 (Wed, 26 Sep 2007) New Revision: 2991 Modified: SQLObject/docs/Inheritance.txt Log: Updated Inheritance docs. Modified: SQLObject/docs/Inheritance.txt =================================================================== --- SQLObject/docs/Inheritance.txt 2007-09-26 14:31:58 UTC (rev 2990) +++ SQLObject/docs/Inheritance.txt 2007-09-26 14:32:11 UTC (rev 2991) @@ -282,7 +282,7 @@ Limitations and notes ~~~~~~~~~~~~~~~~~~~~~ -* Only simple inheritance will work. It is not possible to inherit +* Only single inheritance will work. It is not possible to inherit from multiple SQLObject classes. * It is possible to inherit from an inherited class and this will work well. In the above example, you can have a Chief class that @@ -297,6 +297,18 @@ set lazyUpdate to True. If you need this, you have to patch SQLObject and override many methods - _SO_setValue(), sync(), syncUpdate() at least. Patches will be gladly accepted. +* You'd better restrain yourself to simple use cases. The inheritance + implementation is easiliy choked on more complex cases. +* A join between tables inherited from the same parent produces incorrect + result due to joins to the same parent table (they must use different + aliases). +* Inheritance works in two stages - first it draws the IDs from the parent + table and then it drwas the rows from the children tables. The first + stage could fail if you try to do complex things. For example, + Children.select(orderBy=Children.q.column, distinct=True) + could fail because at the first stage inheritance generates a SELECT + query for the parent table with ORDER BY the column from the children + table. * I made it because I needed to be able to have automatic inheritance with linked tables. * This version works for me; it may not work for you. I tried to do |
|
From: <sub...@co...> - 2007-09-26 14:32:05
|
Author: phd Date: 2007-09-26 08:31:58 -0600 (Wed, 26 Sep 2007) New Revision: 2990 Modified: SQLObject/branches/0.9/docs/Inheritance.txt Log: Updated Inheritance docs. Modified: SQLObject/branches/0.9/docs/Inheritance.txt =================================================================== --- SQLObject/branches/0.9/docs/Inheritance.txt 2007-09-26 14:31:47 UTC (rev 2989) +++ SQLObject/branches/0.9/docs/Inheritance.txt 2007-09-26 14:31:58 UTC (rev 2990) @@ -282,7 +282,7 @@ Limitations and notes ~~~~~~~~~~~~~~~~~~~~~ -* Only simple inheritance will work. It is not possible to inherit +* Only single inheritance will work. It is not possible to inherit from multiple SQLObject classes. * It is possible to inherit from an inherited class and this will work well. In the above example, you can have a Chief class that @@ -297,6 +297,18 @@ set lazyUpdate to True. If you need this, you have to patch SQLObject and override many methods - _SO_setValue(), sync(), syncUpdate() at least. Patches will be gladly accepted. +* You'd better restrain yourself to simple use cases. The inheritance + implementation is easiliy choked on more complex cases. +* A join between tables inherited from the same parent produces incorrect + result due to joins to the same parent table (they must use different + aliases). +* Inheritance works in two stages - first it draws the IDs from the parent + table and then it drwas the rows from the children tables. The first + stage could fail if you try to do complex things. For example, + Children.select(orderBy=Children.q.column, distinct=True) + could fail because at the first stage inheritance generates a SELECT + query for the parent table with ORDER BY the column from the children + table. * I made it because I needed to be able to have automatic inheritance with linked tables. * This version works for me; it may not work for you. I tried to do |
|
From: <sub...@co...> - 2007-09-26 14:31:51
|
Author: phd Date: 2007-09-26 08:31:47 -0600 (Wed, 26 Sep 2007) New Revision: 2989 Modified: SQLObject/branches/0.8/docs/Inheritance.txt Log: Updated Inheritance docs. Modified: SQLObject/branches/0.8/docs/Inheritance.txt =================================================================== --- SQLObject/branches/0.8/docs/Inheritance.txt 2007-09-26 14:31:36 UTC (rev 2988) +++ SQLObject/branches/0.8/docs/Inheritance.txt 2007-09-26 14:31:47 UTC (rev 2989) @@ -282,7 +282,7 @@ Limitations and notes ~~~~~~~~~~~~~~~~~~~~~ -* Only simple inheritance will work. It is not possible to inherit +* Only single inheritance will work. It is not possible to inherit from multiple SQLObject classes. * It is possible to inherit from an inherited class and this will work well. In the above example, you can have a Chief class that @@ -297,6 +297,18 @@ set lazyUpdate to True. If you need this, you have to patch SQLObject and override many methods - _SO_setValue(), sync(), syncUpdate() at least. Patches will be gladly accepted. +* You'd better restrain yourself to simple use cases. The inheritance + implementation is easiliy choked on more complex cases. +* A join between tables inherited from the same parent produces incorrect + result due to joins to the same parent table (they must use different + aliases). +* Inheritance works in two stages - first it draws the IDs from the parent + table and then it drwas the rows from the children tables. The first + stage could fail if you try to do complex things. For example, + Children.select(orderBy=Children.q.column, distinct=True) + could fail because at the first stage inheritance generates a SELECT + query for the parent table with ORDER BY the column from the children + table. * I made it because I needed to be able to have automatic inheritance with linked tables. * This version works for me; it may not work for you. I tried to do |
|
From: <sub...@co...> - 2007-09-26 14:31:44
|
Author: phd Date: 2007-09-26 08:31:36 -0600 (Wed, 26 Sep 2007) New Revision: 2988 Modified: SQLObject/branches/0.7/docs/Inheritance.txt Log: Updated Inheritance docs. Modified: SQLObject/branches/0.7/docs/Inheritance.txt =================================================================== --- SQLObject/branches/0.7/docs/Inheritance.txt 2007-09-26 02:52:49 UTC (rev 2987) +++ SQLObject/branches/0.7/docs/Inheritance.txt 2007-09-26 14:31:36 UTC (rev 2988) @@ -282,7 +282,7 @@ Limitations and notes ~~~~~~~~~~~~~~~~~~~~~ -* Only simple inheritance will work. It is not possible to inherit +* Only single inheritance will work. It is not possible to inherit from multiple SQLObject classes. * It is possible to inherit from an inherited class and this will work well. In the above example, you can have a Chief class that @@ -297,6 +297,18 @@ set lazyUpdate to True. If you need this, you have to patch SQLObject and override many methods - _SO_setValue(), sync(), syncUpdate() at least. Patches will be gladly accepted. +* You'd better restrain yourself to simple use cases. The inheritance + implementation is easiliy choked on more complex cases. +* A join between tables inherited from the same parent produces incorrect + result due to joins to the same parent table (they must use different + aliases). +* Inheritance works in two stages - first it draws the IDs from the parent + table and then it drwas the rows from the children tables. The first + stage could fail if you try to do complex things. For example, + Children.select(orderBy=Children.q.column, distinct=True) + could fail because at the first stage inheritance generates a SELECT + query for the parent table with ORDER BY the column from the children + table. * I made it because I needed to be able to have automatic inheritance with linked tables. * This version works for me; it may not work for you. I tried to do |
|
From: SourceForge.net <no...@so...> - 2007-09-26 14:15:57
|
Bugs item #1670239, was opened at 2007-02-27 21:37 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1670239&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: General Group: None Status: Open >Resolution: None Priority: 5 Private: No Submitted By: Vladimir Chukharev (chukharevv) Assigned to: Oleg Broytmann (phd) Summary: orderBy='..' conflicts with distinct=True in select() Initial Comment: I tried to execute select() with parameters orderBy and distinct for inheritable tables. Any of the two parameters can be used alone, but if they are used together, an error occurs. The following example is printed in Python shell: from datetime import datetime from sqlobject import * from sqlobject.sqlbuilder import * from sqlobject.inheritance import InheritableSQLObject sqlhub.processConnection = connectionForURI('postgres:///test') class Base(InheritableSQLObject): created = DateTimeCol(default=DateTimeCol.now()) class BaseSample(Base): name = StringCol(length=40, alternateID=True) BaseSample.createTable(ifNotExists=True) Base.createTable(ifNotExists=True) sample = BaseSample(name='Sample1') order=BaseSample.q.created Two working calls of select(). print list(BaseSample.select(orderBy=order)) [<BaseSample 1L name='Sample1' created='datetime.datetime...)'>] print list(BaseSample.select(distinct=True)) [<BaseSample 1L name='Sample1' created='datetime.datetime...)'>] Now the error. print list(BaseSample.select(orderBy=order, distinct=True)) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/sresults.py", line 155, in __iter__ return iter(list(self.lazyIter())) File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/sresults.py", line 163, in lazyIter return conn.iterSelect(self) File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/dbconnection.py", line 364, in iterSelect select, keepConnection=False) File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/inheritance/iteration.py", line 10, in __init__ super(InheritableIteration, self).__init__(dbconn, rawconn, select, keepConnection) File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/dbconnection.py", line 704, in __init__ self.dbconn._executeRetry(self.rawconn, self.cursor, self.query) File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/dbconnection.py", line 298, in _executeRetry return cursor.execute(query) psycopg.ProgrammingError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list SELECT DISTINCT base_sample.id, base_sample.child_name, base_sample.name FROM base, base_sample WHERE ((1 = 1) AND ((base_sample.id) = (base.id))) ORDER BY base.created Additional information. SQLObject-0.7.1dev_r1860 TurboGears-1.0b1 Ubuntu $ uname -a Linux svetlana-desktop 2.6.15-28-amd64-generic #1 SMP PREEMPT Thu Feb 1 15:53:41 UTC 2007 x86_64 GNU/Linux ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2007-09-26 18:15 Message: Logged In: YES user_id=4799 Originator: NO I have upgraded to Postgres 8.1 and now see the problem. The root of the problem is that inheritance works in two stages - first, it draws IDs form the base table and then it draws rows from the appropriate children tables. In your case the first stage fails because inheritance generates SELECT for the base table with ORDER BY a column from the child table. I am still thinking but really I don't see any reasonable fix for that. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2007-03-19 19:04 Message: Logged In: YES user_id=4799 Originator: NO Seems your database is stricter than mine as my Postgres 7.4 allows this: 9/Select : SELECT DISTINCT base.id, base.created, base.child_name FROM base, base_sample WHERE (((base.child_name) = ('BaseSample')) AND ((base_sample.id) = (base.id))) ORDER BY base_sample.name 9/QueryR : SELECT DISTINCT base.id, base.created, base.child_name FROM base, base_sample WHERE (((base.child_name) = ('BaseSample')) AND ((base_sample.id) = (base.id))) ORDER BY base_sample.name 9/Select children of the class BaseSample: SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 9/QueryR : SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) [<BaseSample 1 name='Sample1' created='datetime.datetime...)'>] Well, that's a problem... The lack of 'distinct' parameter from Select() is not intentional - just nobody has implemented it. There is an open bug report about that. It can be fixed, and it's being fixed in the sqlbuilder-views branch by Luke Opperman: http://svn.colorstudy.com/SQLObject/branches/sqlbuilder-views/ . I will ask Luke when and how he is going to merge the branch into the trunk. ---------------------------------------------------------------------- Comment By: Vladimir Chukharev (chukharevv) Date: 2007-03-17 11:27 Message: Logged In: YES user_id=607106 Originator: YES Thanks a lot for your followup. We have upgraded our system for the use of SO 0.8 (BTW, some changes to our code were needed with the names of foreign key fields, perhaps something about possible incompatibility of the versions is due for the release notes). Indeed, the previous example now works. But the same conflict remains, just the table changed from Base to BaseSample for our test. As a continuation of your commands: print list(BaseSample.select(orderBy=BaseSample.q.name, distinct=True)) 1/Select : SELECT DISTINCT base.id, base.created, base.child_name FROM base, base_sample WHERE (((base.child_name) = ('BaseSample')) AND ((base_sample.id) = (base.id))) ORDER BY base_sample.name 1/QueryR : SELECT DISTINCT base.id, base.created, base.child_name FROM base, base_sample WHERE (((base.child_name) = ('BaseSample')) AND ((base_sample.id) = (base.id))) ORDER BY base_sample.name Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/sresults.py", line 160, in __iter__ return iter(list(self.lazyIter())) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/sresults.py", line 168, in lazyIter return conn.iterSelect(self) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/dbconnection.py", line 374, in iterSelect select, keepConnection=False) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/inheritance/iteration.py", line 10, in __init__ super(InheritableIteration, self).__init__(dbconn, rawconn, select, keepConnection) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/dbconnection.py", line 760, in __init__ self.dbconn._executeRetry(self.rawconn, self.cursor, self.query) File "/usr/local/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/dbconnection.py", line 308, in _executeRetry return cursor.execute(query) psycopg.ProgrammingError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list SELECT DISTINCT base.id, base.created, base.child_name FROM base, base_sample WHERE (((base.child_name) = ('BaseSample')) AND ((base_sample.id) = (base.id))) ORDER BY base_sample.name Thanks again, V. Chukharev PS. As a side note, is lack of distinct parameter from Select() intentional and can that be fixed? PPS. Thanks for spotting now() insead of now. It was forgotten after some experiments with both variants. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2007-02-28 14:29 Message: Logged In: YES user_id=4799 Originator: NO Works in SQLObject 0.8: from datetime import datetime from sqlobject import * from sqlobject.inheritance import InheritableSQLObject from sqlobject.sqlbuilder import * __connection__ = "postgres:/test?debug=1" class Base(InheritableSQLObject): created = DateTimeCol(default=DateTimeCol.now()) class BaseSample(Base): name = StringCol(length=40, alternateID=True) Base.createTable(ifNotExists=True) BaseSample.createTable(ifNotExists=True) sample = BaseSample(name='Sample1') order=BaseSample.q.created print list(BaseSample.select(orderBy=order)) print list(BaseSample.select(distinct=True)) print list(BaseSample.select(orderBy=order, distinct=True)) Debugging output; please note base.created is in the select list in the last SELECT DISTINCT query: 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'base' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'base' 1/COMMIT : auto 1/Query : CREATE TABLE base ( id SERIAL PRIMARY KEY, created TIMESTAMP, child_name VARCHAR(255) ) 1/QueryR : CREATE TABLE base ( id SERIAL PRIMARY KEY, created TIMESTAMP, child_name VARCHAR(255) ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'base_sample' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'base_sample' 1/COMMIT : auto 1/Query : CREATE TABLE base_sample ( id SERIAL PRIMARY KEY, name VARCHAR(40) NOT NULL UNIQUE, child_name VARCHAR(255) ) 1/QueryR : CREATE TABLE base_sample ( id SERIAL PRIMARY KEY, name VARCHAR(40) NOT NULL UNIQUE, child_name VARCHAR(255) ) 1/COMMIT : auto 1/QueryIns: INSERT INTO base (id, child_name, created) VALUES (1, 'BaseSample', '2007-02-28 14:24:22') 1/COMMIT : auto 1/QueryOne: SELECT created, child_name FROM base WHERE id = (1) 1/QueryR : SELECT created, child_name FROM base WHERE id = (1) 1/COMMIT : auto 1/QueryIns: INSERT INTO base_sample (id, name, child_name) VALUES (1, 'Sample1', NULL) 1/COMMIT : auto 1/QueryOne: SELECT name, child_name FROM base_sample WHERE id = (1) 1/QueryR : SELECT name, child_name FROM base_sample WHERE id = (1) 1/COMMIT : auto 1/Select : SELECT base.id, base.created, base.child_name FROM base WHERE ((base.child_name) = ('BaseSample')) ORDER BY base.created 1/QueryR : SELECT base.id, base.created, base.child_name FROM base WHERE ((base.child_name) = ('BaseSample')) ORDER BY base.created 1/Select children of the class BaseSample: SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 1/QueryR : SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 1/COMMIT : auto [<BaseSample 1L name='Sample1' created='datetime.datetime...)'>] 1/Select : SELECT DISTINCT base.id, base.created, base.child_name FROM base WHERE ((base.child_name) = ('BaseSample')) 1/QueryR : SELECT DISTINCT base.id, base.created, base.child_name FROM base WHERE ((base.child_name) = ('BaseSample')) 1/Select children of the class BaseSample: SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 1/QueryR : SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 1/COMMIT : auto [<BaseSample 1L name='Sample1' created='datetime.datetime...)'>] 1/Select : SELECT DISTINCT base.id, base.created, base.child_name FROM base WHERE ((base.child_name) = ('BaseSample')) ORDER BY base.created 1/QueryR : SELECT DISTINCT base.id, base.created, base.child_name FROM base WHERE ((base.child_name) = ('BaseSample')) ORDER BY base.created 1/Select children of the class BaseSample: SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 1/QueryR : SELECT base_sample.id, base_sample.name, base_sample.child_name FROM base_sample WHERE ((base_sample.id) = (1)) 1/COMMIT : auto [<BaseSample 1L name='Sample1' created='datetime.datetime...)'>] PS. I hope you understand the difference between created = DateTimeCol(default=DateTimeCol.now()) and created = DateTimeCol(default=DateTimeCol.now) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1670239&group_id=74338 |
|
From: <sub...@co...> - 2007-09-26 02:52:52
|
Author: novalis
Date: 2007-09-25 20:52:49 -0600 (Tue, 25 Sep 2007)
New Revision: 2987
Modified:
SQLObject/trunk/sqlobject/versioning/test/test_version.py
Log:
make versioning tests pass
Modified: SQLObject/trunk/sqlobject/versioning/test/test_version.py
===================================================================
--- SQLObject/trunk/sqlobject/versioning/test/test_version.py 2007-09-26 02:52:25 UTC (rev 2986)
+++ SQLObject/trunk/sqlobject/versioning/test/test_version.py 2007-09-26 02:52:49 UTC (rev 2987)
@@ -56,7 +56,7 @@
else:
classes.append(HasForeign)
for cls in classes:
- if hasattr(cls, 'versions') and hasattr(cls, "_connection") and \
+ if hasattr(cls, 'versions') and getattr(cls, "_connection", None) and \
cls._connection.tableExists(cls.sqlmeta.table):
setupClass(cls.versions.versionClass)
setupClass(cls)
|
|
From: <sub...@co...> - 2007-09-26 02:52:31
|
Author: novalis
Date: 2007-09-25 20:52:25 -0600 (Tue, 25 Sep 2007)
New Revision: 2986
Modified:
SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
Log:
make blobcols work with real binary data
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2007-09-25 15:38:45 UTC (rev 2985)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2007-09-26 02:52:25 UTC (rev 2986)
@@ -110,7 +110,10 @@
# For MySQLdb 1.2.1 and later, we go
# encoding->unicode->charset (in the mysql db)
if self.need_unicode and not isinstance(query, unicode):
- query = unicode(query, self.encoding)
+ try:
+ query = unicode(query, self.encoding)
+ except UnicodeError:
+ pass
return cursor.execute(query)
except MySQLdb.OperationalError, e:
if e.args[0] in (MySQLdb.constants.CR.SERVER_GONE_ERROR, MySQLdb.constants.CR.SERVER_LOST):
|
|
From: <sub...@co...> - 2007-09-25 15:38:55
|
Author: phd
Date: 2007-09-25 09:38:45 -0600 (Tue, 25 Sep 2007)
New Revision: 2985
Modified:
SQLObject/trunk/sqlobject/col.py
Log:
Use pickle.HIGHEST_PROTOCOL by default.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2007-09-24 15:26:52 UTC (rev 2984)
+++ SQLObject/trunk/sqlobject/col.py 2007-09-25 15:38:45 UTC (rev 2985)
@@ -1433,12 +1433,12 @@
def from_python(self, value, state):
if value is None:
return None
- return pickle.dumps(value)
+ return pickle.dumps(value, self.pickleProtocol)
class SOPickleCol(SOBLOBCol):
def __init__(self, **kw):
- self.pickleProtocol = popKey(kw, 'pickleProtocol', 1)
+ self.pickleProtocol = popKey(kw, 'pickleProtocol', pickle.HIGHEST_PROTOCOL)
super(SOPickleCol, self).__init__(**kw)
def createValidators(self):
|
|
From: <sub...@co...> - 2007-09-24 15:51:47
|
Author: phd
Date: 2007-09-24 09:26:52 -0600 (Mon, 24 Sep 2007)
New Revision: 2984
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/declarative.py
Log:
Removed from __future__ import generators.
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2007-09-24 15:18:42 UTC (rev 2983)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2007-09-24 15:26:52 UTC (rev 2984)
@@ -1,5 +1,3 @@
-from __future__ import generators
-
import threading
from util.threadinglocal import local as threading_local
import sys
Modified: SQLObject/trunk/sqlobject/declarative.py
===================================================================
--- SQLObject/trunk/sqlobject/declarative.py 2007-09-24 15:18:42 UTC (rev 2983)
+++ SQLObject/trunk/sqlobject/declarative.py 2007-09-24 15:26:52 UTC (rev 2984)
@@ -32,7 +32,6 @@
or an instance method depending on where it is called.
"""
-from __future__ import generators
import threading
import events
@@ -40,16 +39,8 @@
import copy
-try:
- import itertools
- counter = itertools.count()
-except ImportError:
- def _counter():
- i = 0
- while 1:
- i += 1
- yield i
- counter = _counter()
+import itertools
+counter = itertools.count()
class classinstancemethod(object):
"""
|
|
From: <sub...@co...> - 2007-09-24 15:18:51
|
Author: phd
Date: 2007-09-24 09:18:42 -0600 (Mon, 24 Sep 2007)
New Revision: 2983
Removed:
SQLObject/trunk/sqlobject/util/backports.py
Modified:
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/inheritance/iteration.py
SQLObject/trunk/sqlobject/tests/test_select.py
SQLObject/trunk/sqlobject/tests/test_unicode.py
Log:
Python 2.3 has enumerate(), itertools.count().
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2007-09-24 15:01:00 UTC (rev 2982)
+++ SQLObject/trunk/sqlobject/col.py 2007-09-24 15:18:42 UTC (rev 2983)
@@ -31,7 +31,7 @@
from formencode import compound
from formencode import validators
from classregistry import findClass
-from util.backports import count
+from itertools import count
NoDefault = sqlbuilder.NoDefault
Modified: SQLObject/trunk/sqlobject/inheritance/iteration.py
===================================================================
--- SQLObject/trunk/sqlobject/inheritance/iteration.py 2007-09-24 15:01:00 UTC (rev 2982)
+++ SQLObject/trunk/sqlobject/inheritance/iteration.py 2007-09-24 15:18:42 UTC (rev 2983)
@@ -14,8 +14,8 @@
# Find the index of the childName column
childNameIdx = None
columns = select.sourceClass.sqlmeta.columnList
- for i in range(len(columns)): # enumerate() is unavailable python 2.2
- if columns[i].name == "childName":
+ for i, column in enumerate(columns):
+ if column.name == "childName":
childNameIdx = i
break
self._childNameIdx = childNameIdx
Modified: SQLObject/trunk/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_select.py 2007-09-24 15:01:00 UTC (rev 2982)
+++ SQLObject/trunk/sqlobject/tests/test_select.py 2007-09-24 15:18:42 UTC (rev 2983)
@@ -1,19 +1,9 @@
-from __future__ import generators # for enumerate
from sqlobject import *
from sqlobject.sqlbuilder import func
from sqlobject.main import SQLObjectIntegrityError
from dbtest import *
from dbtest import setSQLiteConnectionFactory
-try:
- enumerate
-except NameError:
- def enumerate(iterable):
- i = 0
- for obj in iterable:
- yield i, obj
- i += 1
-
class IterTest(SQLObject):
name = StringCol(dbName='name_col')
Modified: SQLObject/trunk/sqlobject/tests/test_unicode.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_unicode.py 2007-09-24 15:01:00 UTC (rev 2982)
+++ SQLObject/trunk/sqlobject/tests/test_unicode.py 2007-09-24 15:18:42 UTC (rev 2983)
@@ -10,12 +10,6 @@
col1 = UnicodeCol(alternateID=True)
col2 = UnicodeCol(dbEncoding='latin-1')
-try:
- enumerate
-except NameError: # Python 2.2
- def enumerate(lst):
- return [(i, lst[i]) for i in range(len(lst))]
-
data = [u'\u00f0', u'test', 'ascii test']
items = []
Deleted: SQLObject/trunk/sqlobject/util/backports.py
===================================================================
--- SQLObject/trunk/sqlobject/util/backports.py 2007-09-24 15:01:00 UTC (rev 2982)
+++ SQLObject/trunk/sqlobject/util/backports.py 2007-09-24 15:18:42 UTC (rev 2983)
@@ -1,21 +0,0 @@
-from __future__ import generators
-
-__all__ = ['count', 'enumerate']
-
-# An implementation of itertools' count()
-try:
- from itertools import count
-except ImportError:
- def count(start=0):
- while 1:
- yield start
- start += 1
-
-try:
- enumerate
-except NameError:
- def enumerate(lst):
- i = 0
- for item in lst:
- yield i, item
- i += 1
|
|
From: <sub...@co...> - 2007-09-24 15:01:14
|
Author: phd
Date: 2007-09-24 09:01:00 -0600 (Mon, 24 Sep 2007)
New Revision: 2982
Modified:
SQLObject/trunk/sqlobject/tests/test_select.py
Log:
Python 2.3 has sum().
Modified: SQLObject/trunk/sqlobject/tests/test_select.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_select.py 2007-09-22 02:21:43 UTC (rev 2981)
+++ SQLObject/trunk/sqlobject/tests/test_select.py 2007-09-24 15:01:00 UTC (rev 2982)
@@ -133,14 +133,6 @@
assert func([c.n1 for c in counters]) == value
def test_1(self):
- try:
- sum
- except NameError:
- def sum(sequence):
- s = 0
- for item in sequence:
- s = s + item
- return s
self.accumulateEqual(sum,Counter2.select(orderBy='n1'),
sum(range(10)) * 10)
|
|
From: Terry S. <996...@jo...> - 2007-09-22 14:38:37
|
Hello! I am tired tonight. I am nice girl that would like to chat with you. Email me at dq...@Ne... only, because I am writing not from my personal email. You will see some of my private pics. |
|
From: <sub...@co...> - 2007-09-21 14:08:58
|
Author: phd
Date: 2007-09-21 08:08:43 -0600 (Fri, 21 Sep 2007)
New Revision: 2976
Modified:
SQLObject/trunk/sqlobject/cache.py
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/constraints.py
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/inheritance/__init__.py
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/sqlbuilder.py
SQLObject/trunk/sqlobject/styles.py
Log:
Removed True/False emulation - Python 2.3 has the real bool type and the real True/False values.
Modified: SQLObject/trunk/sqlobject/cache.py
===================================================================
--- SQLObject/trunk/sqlobject/cache.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/cache.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -10,8 +10,6 @@
from weakref import ref
from time import time as now
-True, False = 1==1, 0==1
-
class CacheFactory(object):
"""
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/col.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -34,7 +34,6 @@
from util.backports import count
NoDefault = sqlbuilder.NoDefault
-True, False = 1==1, 0==1
import datetime
datetime_available = True
Modified: SQLObject/trunk/sqlobject/constraints.py
===================================================================
--- SQLObject/trunk/sqlobject/constraints.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/constraints.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -2,8 +2,6 @@
Constraints
"""
-True, False = (1==1), (0==1)
-
class BadValue(ValueError):
def __init__(self, desc, obj, col, value, *args):
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -1,7 +1,5 @@
from __future__ import generators
-True, False = 1==1, 0==1
-
import threading
from util.threadinglocal import local as threading_local
import sys
Modified: SQLObject/trunk/sqlobject/inheritance/__init__.py
===================================================================
--- SQLObject/trunk/sqlobject/inheritance/__init__.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/inheritance/__init__.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -1,7 +1,7 @@
from sqlobject import sqlbuilder
from sqlobject import classregistry
from sqlobject.col import StringCol, ForeignKey
-from sqlobject.main import sqlmeta, SQLObject, SelectResults, True, False, \
+from sqlobject.main import sqlmeta, SQLObject, SelectResults, \
makeProperties, getterName, setterName
import iteration
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/main.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -59,8 +59,6 @@
class SQLObjectNotFound(LookupError): pass
class SQLObjectIntegrityError(Exception): pass
-True, False = 1==1, 0==1
-
def makeProperties(obj):
"""
This function takes a dictionary of methods and finds
Modified: SQLObject/trunk/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlbuilder.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/sqlbuilder.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -67,8 +67,6 @@
class NoDefault:
pass
-True, False = (1==1), (0==1)
-
import re, fnmatch
import operator
import threading
Modified: SQLObject/trunk/sqlobject/styles.py
===================================================================
--- SQLObject/trunk/sqlobject/styles.py 2007-09-20 22:27:57 UTC (rev 2975)
+++ SQLObject/trunk/sqlobject/styles.py 2007-09-21 14:08:43 UTC (rev 2976)
@@ -3,8 +3,6 @@
__all__ = ["Style", "MixedCaseUnderscoreStyle", "DefaultStyle",
"MixedCaseStyle"]
-True, False = 1==1, 0==1
-
class Style(object):
"""
|