sqlobject-cvs Mailing List for SQLObject (Page 106)
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-02-06 15:39:25
|
Author: phd
Date: 2007-02-06 08:39:04 -0700 (Tue, 06 Feb 2007)
New Revision: 2260
Modified:
SQLObject/branches/0.8/sqlobject/converters.py
SQLObject/branches/0.8/sqlobject/tests/test_converters.py
Log:
A patch by Dan Pascu <da...@ag...> - allows to use set/frozenset sets/Set/ImmutableSet
sets as sequences passed to the IN operator.
Modified: SQLObject/branches/0.8/sqlobject/converters.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/converters.py 2007-02-06 15:38:47 UTC (rev 2259)
+++ SQLObject/branches/0.8/sqlobject/converters.py 2007-02-06 15:39:04 UTC (rev 2260)
@@ -180,6 +180,21 @@
registerConverter(type(()), SequenceConverter)
registerConverter(type([]), SequenceConverter)
+registerConverter(type({}), SequenceConverter)
+try:
+ set, frozenset
+except NameError:
+ pass
+else:
+ registerConverter(set, SequenceConverter)
+ registerConverter(frozenset, SequenceConverter)
+try:
+ from sets import Set, ImmutableSet
+except ImportError:
+ pass
+else:
+ registerConverter(Set, SequenceConverter)
+ registerConverter(ImmutableSet, SequenceConverter)
if hasattr(time, 'struct_time'):
def StructTimeConverter(value, db):
Modified: SQLObject/branches/0.8/sqlobject/tests/test_converters.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/tests/test_converters.py 2007-02-06 15:38:47 UTC (rev 2259)
+++ SQLObject/branches/0.8/sqlobject/tests/test_converters.py 2007-02-06 15:39:04 UTC (rev 2260)
@@ -176,3 +176,20 @@
def test_prefix():
instance = SQLPrefix('test', 'test')
assert sqlrepr(instance, 'mysql') == "test 'test'"
+
+def test_dict():
+ assert sqlrepr({"key": "value"}, "sqlite") == "('key')"
+
+def test_sets():
+ try:
+ set
+ except NameError:
+ pass
+ else:
+ assert sqlrepr(set([1])) == "(1)"
+ try:
+ from sets import Set
+ except ImportError:
+ pass
+ else:
+ assert sqlrepr(Set([1])) == "(1)"
|
|
From: <sub...@co...> - 2007-02-06 15:39:02
|
Author: phd Date: 2007-02-06 08:38:47 -0700 (Tue, 06 Feb 2007) New Revision: 2259 Modified: SQLObject/docs/News.txt Log: A patch by Dan Pascu <da...@ag...> - allows to use set/frozenset sets/Set/ImmutableSet sets as sequences passed to the IN operator. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2007-02-06 15:38:30 UTC (rev 2258) +++ SQLObject/docs/News.txt 2007-02-06 15:38:47 UTC (rev 2259) @@ -124,6 +124,9 @@ * With empty parameters AND() and OR() returns None. +* Allows to use set/frozenset sets/Set/ImmutableSet sets as sequences + passed to the IN operator. + Bug Fixes --------- |
|
From: <sub...@co...> - 2007-02-06 15:38:53
|
Author: phd
Date: 2007-02-06 08:38:30 -0700 (Tue, 06 Feb 2007)
New Revision: 2258
Modified:
SQLObject/trunk/sqlobject/converters.py
SQLObject/trunk/sqlobject/tests/test_converters.py
Log:
A patch by Dan Pascu <da...@ag...> - allows to use set/frozenset sets/Set/ImmutableSet
sets as sequences passed to the IN operator.
Modified: SQLObject/trunk/sqlobject/converters.py
===================================================================
--- SQLObject/trunk/sqlobject/converters.py 2007-02-06 15:23:02 UTC (rev 2257)
+++ SQLObject/trunk/sqlobject/converters.py 2007-02-06 15:38:30 UTC (rev 2258)
@@ -180,6 +180,21 @@
registerConverter(type(()), SequenceConverter)
registerConverter(type([]), SequenceConverter)
+registerConverter(type({}), SequenceConverter)
+try:
+ set, frozenset
+except NameError:
+ pass
+else:
+ registerConverter(set, SequenceConverter)
+ registerConverter(frozenset, SequenceConverter)
+try:
+ from sets import Set, ImmutableSet
+except ImportError:
+ pass
+else:
+ registerConverter(Set, SequenceConverter)
+ registerConverter(ImmutableSet, SequenceConverter)
if hasattr(time, 'struct_time'):
def StructTimeConverter(value, db):
Modified: SQLObject/trunk/sqlobject/tests/test_converters.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_converters.py 2007-02-06 15:23:02 UTC (rev 2257)
+++ SQLObject/trunk/sqlobject/tests/test_converters.py 2007-02-06 15:38:30 UTC (rev 2258)
@@ -176,3 +176,20 @@
def test_prefix():
instance = SQLPrefix('test', 'test')
assert sqlrepr(instance, 'mysql') == "test 'test'"
+
+def test_dict():
+ assert sqlrepr({"key": "value"}, "sqlite") == "('key')"
+
+def test_sets():
+ try:
+ set
+ except NameError:
+ pass
+ else:
+ assert sqlrepr(set([1])) == "(1)"
+ try:
+ from sets import Set
+ except ImportError:
+ pass
+ else:
+ assert sqlrepr(Set([1])) == "(1)"
|
|
From: <sub...@co...> - 2007-02-06 15:23:11
|
Author: phd
Date: 2007-02-06 08:23:02 -0700 (Tue, 06 Feb 2007)
New Revision: 2257
Added:
SQLObject/branches/0.8/sqlobject/tests/test_sqlbuilder.py
Modified:
SQLObject/branches/0.8/sqlobject/sqlbuilder.py
Log:
A patch by Johan Dahlin <jd...@as...> - with empty parameters AND() and OR() returns None.
Modified: SQLObject/branches/0.8/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/sqlbuilder.py 2007-02-06 15:21:18 UTC (rev 2256)
+++ SQLObject/branches/0.8/sqlobject/sqlbuilder.py 2007-02-06 15:23:02 UTC (rev 2257)
@@ -626,6 +626,8 @@
return '%s DESC' % sqlrepr(self.expr, db)
def AND(*ops):
+ if not ops:
+ return None
op1 = ops[0]
ops = ops[1:]
if ops:
@@ -634,6 +636,8 @@
return op1
def OR(*ops):
+ if not ops:
+ return None
op1 = ops[0]
ops = ops[1:]
if ops:
Added: SQLObject/branches/0.8/sqlobject/tests/test_sqlbuilder.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/tests/test_sqlbuilder.py (rev 0)
+++ SQLObject/branches/0.8/sqlobject/tests/test_sqlbuilder.py 2007-02-06 15:23:02 UTC (rev 2257)
@@ -0,0 +1,14 @@
+from sqlobject.sqlbuilder import AND, SQLOp, sqlrepr
+
+def test_empty_AND():
+ assert AND() == None
+ assert AND(True) == True
+
+ # sqlrepr() is needed because AND() returns an SQLExpression that overrides
+ # comparison. The following
+ # AND('x', 'y') == "foo bar"
+ # is True! (-: Eeek!
+ assert sqlrepr(AND(1, 2)) == sqlrepr(SQLOp("AND", 1, 2)) == "((1) AND (2))"
+ assert sqlrepr(AND(1, 2, '3'), "sqlite") == \
+ sqlrepr(SQLOp("AND", 1, SQLOp("AND", 2, '3')), "sqlite") == \
+ "((1) AND ((2) AND ('3')))"
|
|
From: <sub...@co...> - 2007-02-06 15:21:54
|
Author: phd Date: 2007-02-06 08:21:18 -0700 (Tue, 06 Feb 2007) New Revision: 2256 Modified: SQLObject/docs/News.txt Log: A patch by Johan Dahlin <jd...@as...> - with empty parameters AND() and OR() returns None. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2007-02-06 15:21:02 UTC (rev 2255) +++ SQLObject/docs/News.txt 2007-02-06 15:21:18 UTC (rev 2256) @@ -122,6 +122,8 @@ NotImplementedError in case one tries bool(MyTable.select()) or "if MyTable.select():..." +* With empty parameters AND() and OR() returns None. + Bug Fixes --------- |
|
From: <sub...@co...> - 2007-02-06 15:21:23
|
Author: phd
Date: 2007-02-06 08:21:02 -0700 (Tue, 06 Feb 2007)
New Revision: 2255
Added:
SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py
Modified:
SQLObject/trunk/sqlobject/sqlbuilder.py
Log:
A patch by Johan Dahlin <jd...@as...> - with empty parameters AND() and OR() returns None.
Modified: SQLObject/trunk/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlbuilder.py 2007-02-06 05:19:37 UTC (rev 2254)
+++ SQLObject/trunk/sqlobject/sqlbuilder.py 2007-02-06 15:21:02 UTC (rev 2255)
@@ -626,6 +626,8 @@
return '%s DESC' % sqlrepr(self.expr, db)
def AND(*ops):
+ if not ops:
+ return None
op1 = ops[0]
ops = ops[1:]
if ops:
@@ -634,6 +636,8 @@
return op1
def OR(*ops):
+ if not ops:
+ return None
op1 = ops[0]
ops = ops[1:]
if ops:
Added: SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py (rev 0)
+++ SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py 2007-02-06 15:21:02 UTC (rev 2255)
@@ -0,0 +1,14 @@
+from sqlobject.sqlbuilder import AND, SQLOp, sqlrepr
+
+def test_empty_AND():
+ assert AND() == None
+ assert AND(True) == True
+
+ # sqlrepr() is needed because AND() returns an SQLExpression that overrides
+ # comparison. The following
+ # AND('x', 'y') == "foo bar"
+ # is True! (-: Eeek!
+ assert sqlrepr(AND(1, 2)) == sqlrepr(SQLOp("AND", 1, 2)) == "((1) AND (2))"
+ assert sqlrepr(AND(1, 2, '3'), "sqlite") == \
+ sqlrepr(SQLOp("AND", 1, SQLOp("AND", 2, '3')), "sqlite") == \
+ "((1) AND ((2) AND ('3')))"
|
|
From: SourceForge.net <no...@so...> - 2007-02-05 19:31:13
|
Bugs item #1652661, was opened at 2007-02-05 17:31 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652661&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Postgres Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Elvis Pfutzenreuter (epx) Assigned to: Nobody/Anonymous (nobody) Summary: orderBy with negative sign does not work for DateCol's Initial Comment: Version: SQLObject-0.7.3-py2.4.egg While using select(..., orderBy=-datecolumn) works for MySQL, it fails for PostgreSQL. The report error is: ERROR: operator does not exist: - timestamp without time zone\nHINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. Probably Postgres does not like arithmetic operations with timestamps/dates. Removing the negative sign and doing select(orderby=datecolumn).reversed() works just fine. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652661&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2007-02-05 11:02:52
|
Bugs item #1652309, was opened at 2007-02-05 03:02 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652309&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: MySQL Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: _executeRetry fails if self.encoding is utf8 Initial Comment: Version: SQLObject-0.8.0b2-py2.4 E-Mail adresse: sql...@xc... _executeRetry fails if self.encoding is utf8. My connection string looks as follows: sqlobject.dburi="mysql://foo:bar@localhost/mallorca?use_unicode=1&unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8&sqlobject_encoding=utf8" I think changing sqlobject/mysql/my sqlconnection.py Line 98 from if self.need_unicode: doo something to if self.need_unicode and self.encoding != "utf8" would solve the problem --- snip -- 500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request. Page handler: <function _wrapper at 0xb71b5764> Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run self.main() File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main body = page_handler(*virtual_path, **self.params) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/identity/conditions.py", line 275, in _wrapper return fn( *args, **kw ) File "<string>", line 3, in default File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 334, in expose output = database.run_with_transaction( File "<string>", line 5, in run_with_transaction File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/database.py", line 302, in so_rwt retval = func(*args, **kw) File "<string>", line 5, in _expose File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 351, in <lambda> mapping, fragment, args, kw))) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 391, in _execute_func return _process_output(output, template, format, content_type, mapping, fragment) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 82, in _process_output fragment=fragment) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/view/base.py", line 131, in render return engine.render(**kw) File "/usr/lib/python2.4/site-packages/TurboCheetah-0.9.5-py2.4.egg/turbocheetah/cheetahsupport.py", line 115, in render return str(tempobj) File "/usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Template.py", line 990, in __str__ def __str__(self): return getattr(self, mainMethName)() File "/data/www/hermes/mallorca/mallorca/mallorca/templates/admin_base.py", line 474, in respond _v = VFFSL(SL,"content",True) # '${content}' on line 114, col 13 File "/data/www/hermes/mallorca/mallorca/mallorca/templates/admin_fincas.py", line 95, in content for object in VFFSL(SL,"objects",True): # generated from line 11, col 9 File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/sresults.py", line 160, in __iter__ return iter(list(self.lazyIter())) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/sresults.py", line 168, in lazyIter return conn.iterSelect(self) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/dbconnection.py", line 831, in iterSelect select, keepConnection=True))) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/dbconnection.py", line 760, in __init__ self.dbconn._executeRetry(self.rawconn, self.cursor, self.query) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/mysql/mysqlconnection.py", line 98, in _executeRetry myquery = unicode(query, self.encoding) TypeError: decoding Unicode is not supported -- snip -- ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652309&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2007-02-05 02:40:41
|
Bugs item #1652100, was opened at 2007-02-04 18:40 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652100&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: MySQL Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: _executeRetry fails if self.encoding is utf8 Initial Comment: Version: SQLObject-0.8.0b2-py2.4 E-Mail adresse: sql...@xc... _executeRetry fails if self.encoding is utf8. My connection string looks as follows: sqlobject.dburi="mysql://foo:bar@localhost/mallorca?use_unicode=1&unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8&sqlobject_encoding=utf8" I think changing sqlobject/mysql/my sqlconnection.py Line 98 from if self.need_unicode: doo something to if self.need_unicode and self.encoding != "utf8" would solve the problem --- snip -- 500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request. Page handler: <function _wrapper at 0xb71b5764> Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run self.main() File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main body = page_handler(*virtual_path, **self.params) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/identity/conditions.py", line 275, in _wrapper return fn( *args, **kw ) File "<string>", line 3, in default File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 334, in expose output = database.run_with_transaction( File "<string>", line 5, in run_with_transaction File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/database.py", line 302, in so_rwt retval = func(*args, **kw) File "<string>", line 5, in _expose File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 351, in <lambda> mapping, fragment, args, kw))) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 391, in _execute_func return _process_output(output, template, format, content_type, mapping, fragment) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/controllers.py", line 82, in _process_output fragment=fragment) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/view/base.py", line 131, in render return engine.render(**kw) File "/usr/lib/python2.4/site-packages/TurboCheetah-0.9.5-py2.4.egg/turbocheetah/cheetahsupport.py", line 115, in render return str(tempobj) File "/usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-i686.egg/Cheetah/Template.py", line 990, in __str__ def __str__(self): return getattr(self, mainMethName)() File "/data/www/hermes/mallorca/mallorca/mallorca/templates/admin_base.py", line 474, in respond _v = VFFSL(SL,"content",True) # '${content}' on line 114, col 13 File "/data/www/hermes/mallorca/mallorca/mallorca/templates/admin_fincas.py", line 95, in content for object in VFFSL(SL,"objects",True): # generated from line 11, col 9 File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/sresults.py", line 160, in __iter__ return iter(list(self.lazyIter())) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/sresults.py", line 168, in lazyIter return conn.iterSelect(self) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/dbconnection.py", line 831, in iterSelect select, keepConnection=True))) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/dbconnection.py", line 760, in __init__ self.dbconn._executeRetry(self.rawconn, self.cursor, self.query) File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0b2-py2.4.egg/sqlobject/mysql/mysqlconnection.py", line 98, in _executeRetry myquery = unicode(query, self.encoding) TypeError: decoding Unicode is not supported -- snip -- ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1652100&group_id=74338 |
|
From: <sub...@co...> - 2007-01-30 09:19:56
|
Author: phd
Date: 2007-01-30 02:19:45 -0700 (Tue, 30 Jan 2007)
New Revision: 2250
Modified:
SQLObject/tags/0.7.3/setup.cfg
SQLObject/tags/0.7.3/setup.py
Log:
Released SQLObject 0.7.3.
Modified: SQLObject/tags/0.7.3/setup.cfg
===================================================================
--- SQLObject/tags/0.7.3/setup.cfg 2007-01-30 09:19:04 UTC (rev 2249)
+++ SQLObject/tags/0.7.3/setup.cfg 2007-01-30 09:19:45 UTC (rev 2250)
@@ -1,7 +1,3 @@
-[egg_info]
-tag_build = a
-tag_svn_revision = true
-
[pudge]
title = SQLObject
dest = docs/html
Modified: SQLObject/tags/0.7.3/setup.py
===================================================================
--- SQLObject/tags/0.7.3/setup.py 2007-01-30 09:19:04 UTC (rev 2249)
+++ SQLObject/tags/0.7.3/setup.py 2007-01-30 09:19:45 UTC (rev 2250)
@@ -19,7 +19,7 @@
DistributionMetadata.download_url = None
setup(name="SQLObject",
- version="0.7.2",
+ version="0.7.3",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
@@ -37,7 +37,7 @@
``easy_install SQLObject==dev``
The 0.7 bugfix branch is `also available
-<http://svn.sqlobject.org/SQLObject/branches/0.7-bugfix#egg=SQLObject-bugfix>`_
+<http://svn.sqlobject.org/SQLObject/branches/0.7#egg=SQLObject-bugfix>`_
installable with ``easy_install SQLObject==bugfix``.
""",
classifiers=[
@@ -52,7 +52,7 @@
author="Ian Bicking",
author_email="ia...@co...",
url="http://sqlobject.org",
- download_url="http://cheeseshop.python.org/pypi/SQLObject/0.7.2",
+ download_url="http://cheeseshop.python.org/pypi/SQLObject/0.7.3",
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin"],
|
|
From: <sub...@co...> - 2007-01-30 09:19:12
|
Author: phd
Date: 2007-01-30 02:19:04 -0700 (Tue, 30 Jan 2007)
New Revision: 2249
Modified:
SQLObject/branches/0.7/setup.py
Log:
SQLObject 0.7.3.
Modified: SQLObject/branches/0.7/setup.py
===================================================================
--- SQLObject/branches/0.7/setup.py 2007-01-30 09:17:01 UTC (rev 2248)
+++ SQLObject/branches/0.7/setup.py 2007-01-30 09:19:04 UTC (rev 2249)
@@ -19,7 +19,7 @@
DistributionMetadata.download_url = None
setup(name="SQLObject",
- version="0.7.2",
+ version="0.7.3",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
@@ -37,7 +37,7 @@
``easy_install SQLObject==dev``
The 0.7 bugfix branch is `also available
-<http://svn.sqlobject.org/SQLObject/branches/0.7-bugfix#egg=SQLObject-bugfix>`_
+<http://svn.sqlobject.org/SQLObject/branches/0.7#egg=SQLObject-bugfix>`_
installable with ``easy_install SQLObject==bugfix``.
""",
classifiers=[
@@ -52,7 +52,7 @@
author="Ian Bicking",
author_email="ia...@co...",
url="http://sqlobject.org",
- download_url="http://cheeseshop.python.org/pypi/SQLObject/0.7.2",
+ download_url="http://cheeseshop.python.org/pypi/SQLObject/0.7.3",
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin"],
|
|
From: <sub...@co...> - 2007-01-30 09:17:04
|
Author: phd Date: 2007-01-30 02:17:01 -0700 (Tue, 30 Jan 2007) New Revision: 2248 Added: SQLObject/tags/0.7.3/ Log: Tagged SQLObject 0.7.3. Copied: SQLObject/tags/0.7.3 (from rev 2247, SQLObject/branches/0.7) |
|
From: <sub...@co...> - 2007-01-30 09:15:32
|
Author: phd Date: 2007-01-30 02:15:27 -0700 (Tue, 30 Jan 2007) New Revision: 2247 Added: SQLObject/branches/0.7/ Removed: SQLObject/branches/0.7-bugfix/ Log: 0.7 branch was anything but bugfix; it has got a lot of new features. Copied: SQLObject/branches/0.7 (from rev 2246, SQLObject/branches/0.7-bugfix) |
|
From: <sub...@co...> - 2007-01-30 09:12:59
|
Author: phd Date: 2007-01-30 02:12:54 -0700 (Tue, 30 Jan 2007) New Revision: 2246 Modified: SQLObject/docs/News.txt Log: SQLObject 0.7.3 released 30 Jan 2007. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2007-01-30 09:12:01 UTC (rev 2245) +++ SQLObject/docs/News.txt 2007-01-30 09:12:54 UTC (rev 2246) @@ -146,6 +146,8 @@ SQLObject 0.7.3 =============== +Released 30 Jan 2007. + Bug Fixes --------- |
|
From: <sub...@co...> - 2007-01-30 09:12:06
|
Author: phd Date: 2007-01-30 02:12:01 -0700 (Tue, 30 Jan 2007) New Revision: 2245 Modified: SQLObject/branches/0.7-bugfix/docs/News.txt Log: Released 30 Jan 2007. Modified: SQLObject/branches/0.7-bugfix/docs/News.txt =================================================================== --- SQLObject/branches/0.7-bugfix/docs/News.txt 2007-01-29 15:19:34 UTC (rev 2244) +++ SQLObject/branches/0.7-bugfix/docs/News.txt 2007-01-30 09:12:01 UTC (rev 2245) @@ -10,6 +10,8 @@ SQLObject 0.7.3 =============== +Released 30 Jan 2007. + Bug Fixes --------- |
|
From: <sub...@co...> - 2007-01-29 15:19:44
|
Author: phd
Date: 2007-01-29 08:19:34 -0700 (Mon, 29 Jan 2007)
New Revision: 2244
Added:
SQLObject/docs/sqlobject-architecture.txt
Modified:
SQLObject/docs/index.txt
SQLObject/docs/rebuild
Log:
Added a brief description of SQLObject architecture.
Modified: SQLObject/docs/index.txt
===================================================================
--- SQLObject/docs/index.txt 2007-01-26 19:18:17 UTC (rev 2243)
+++ SQLObject/docs/index.txt 2007-01-29 15:19:34 UTC (rev 2244)
@@ -21,6 +21,7 @@
* `Main SQLObject documentation <SQLObject.html>`_
* `Frequently Asked Questions <FAQ.html>`_
* `sqlbuilder documentation <SQLBuilder.html>`_
+* `A brief description of SQLObject architecture <sqlobject-architecture.html>`_
* `sqlobject-admin documentation <sqlobject-admin.html>`_
* `Inheritance <Inheritance.html>`_
* `Versioning <Versioning.html>`_
Modified: SQLObject/docs/rebuild
===================================================================
--- SQLObject/docs/rebuild 2007-01-26 19:18:17 UTC (rev 2243)
+++ SQLObject/docs/rebuild 2007-01-29 15:19:34 UTC (rev 2244)
@@ -8,7 +8,7 @@
NORMAL="Authors DeveloperGuide FAQ Inheritance News SQLBuilder
SQLObject TODO Versioning
web/index web/links web/repository web/community
- index community sqlobject-admin"
+ index community sqlobject-architecture sqlobject-admin"
for NAME in $NORMAL ; do
if [ -e "$NAME.html" -a ! "$NAME.html" -ot "$NAME.txt" ] ; then
Added: SQLObject/docs/sqlobject-architecture.txt
===================================================================
--- SQLObject/docs/sqlobject-architecture.txt (rev 0)
+++ SQLObject/docs/sqlobject-architecture.txt 2007-01-29 15:19:34 UTC (rev 2244)
@@ -0,0 +1,35 @@
+| > SomeTable.select(SomeTable.q.Foo > 30)
+| >
+| > Why doesn't the inner parameter, SomeTable.q.Foo > 30, get evaluated to some boolean value?
+
+.q is an object that returns special attributes of type
+sqlbuilder.SQLExpression. SQLExpression is a special class that overrides
+almost all Python magic methods and upon any operation it, instead of
+evaluating, it constructs another instance of SQLExpression that remembers
+what operation it has to do. A kind of symbolic algebra. Example:
+
+ SQLExpression("foo") > 30
+
+produces SQLExpression("foo", ">", 30) (well, it really produces
+SQLExpression(SQLExpression("foo")...))
+
+| > How does the select(...) method know what to do?
+
+In short, .select() recusively evaluates the top-most SQLExpression to a
+string:
+
+ SQLExpression("foo", ">", 30) => "foo > 30"
+
+and passes the result as a string to the SQL backend.
+
+The longer but more detailed and correct explanation is that .select()
+produces an instance of SelectResults class that upon being iterated over
+produces an instance of Iteration class that upon calling its .next()
+method (it is iterator!) construct the SQL query string, passes it to the
+backend, fetches the results and passes them back to the user.
+
+For the details of the implementation see sqlobject/main.py for SQLObject,
+sqlbuilder.py for SQLExpression, sqlobject/dbconnection.py for DBConnection
+class (that constructs the query strings) and Iteration class, and
+different subdirectories of sqlobject for concrete implementations of
+connection classes - different backends require different query strings.
|
|
From: <sub...@co...> - 2007-01-23 18:02:36
|
Author: phd
Date: 2007-01-23 11:02:01 -0700 (Tue, 23 Jan 2007)
New Revision: 2240
Added:
home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_aggregates.py
home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance_tree.py
Modified:
home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py
home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance.py
home/phd/SQLObject/paramstyles/sqlobject/versioning/__init__.py
home/phd/SQLObject/paramstyles/sqlobject/versioning/test/test_version.py
Log:
Merged patches from the revisions 2227:2239 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py 2007-01-23 17:14:51 UTC (rev 2239)
+++ home/phd/SQLObject/paramstyles/sqlobject/inheritance/__init__.py 2007-01-23 18:02:01 UTC (rev 2240)
@@ -13,17 +13,33 @@
basestring = (types.StringType, types.UnicodeType)
+def tablesUsedDict(obj):
+ if hasattr(obj, "tablesUsedDict"):
+ return obj.tablesUsedDict()
+ elif isinstance(obj, (tuple, list)):
+ d = {}
+ for component in obj:
+ d.update(tablesUsedDict(component))
+ return d
+ else:
+ return {}
+
+
class InheritableSelectResults(SelectResults):
IterationClass = iteration.InheritableIteration
- def __init__(self, sourceClass, clause, clauseTables=None, **ops):
+ def __init__(self, sourceClass, clause, clauseTables=None,
+ inheritedTables=None, **ops):
if clause is None or isinstance(clause, str) and clause == 'all':
clause = sqlbuilder.SQLTrueClause
- tablesDict = sqlbuilder.tablesUsedDict(clause)
+ tablesDict = tablesUsedDict(clause)
tablesDict[sourceClass.sqlmeta.table] = 1
orderBy = ops.get('orderBy')
+ if inheritedTables:
+ for tableName in inheritedTables:
+ tablesDict[tableName] = 1
if orderBy and not isinstance(orderBy, basestring):
- tablesDict.update(sqlbuilder.tablesUsedDict(orderBy))
+ tablesDict.update(tablesUsedDict(orderBy))
#DSM: if this class has a parent, we need to link it
#DSM: and be sure the parent is in the table list.
#DSM: The following code is before clauseTables
@@ -68,6 +84,16 @@
super(InheritableSelectResults, self).__init__(sourceClass,
clause, clauseTables, **ops)
+ def accumulateMany(self, *attributes, **kw):
+ if kw.get("skipInherited"):
+ return super(InheritableSelectResults, self).accumulateMany(*attributes)
+ tables = []
+ for func_name, attribute in attributes:
+ if not isinstance(attribute, basestring):
+ tables.append(attribute.tableName)
+ clone = self.__class__(self.sourceClass, self.clause,
+ self.clauseTables, inheritedTables=tables, **self.ops)
+ return clone.accumulateMany(skipInherited=True, *attributes)
class InheritableSQLMeta(sqlmeta):
def addColumn(sqlmeta, columnDef, changeSchema=False, connection=None, childUpdate=False):
Copied: home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_aggregates.py (from rev 2239, SQLObject/trunk/sqlobject/inheritance/tests/test_aggregates.py)
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_aggregates.py (rev 0)
+++ home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_aggregates.py 2007-01-23 18:02:01 UTC (rev 2240)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestAggregate1(InheritableSQLObject):
+ value1 = IntCol()
+
+class TestAggregate2(TestAggregate1):
+ value2 = IntCol()
+
+def test_aggregates():
+ setupClass([TestAggregate1, TestAggregate2])
+
+ TestAggregate1(value1=1)
+ TestAggregate2(value1=2, value2=12)
+
+ assert TestAggregate1.select().max("value1") == 2
+ assert TestAggregate2.select().max("value1") == 2
+ raises(Exception, TestAggregate2.select().max, "value2")
+ assert TestAggregate2.select().max(TestAggregate2.q.value2) == 12
Modified: home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance.py 2007-01-23 17:14:51 UTC (rev 2239)
+++ home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance.py 2007-01-23 18:02:01 UTC (rev 2240)
@@ -79,6 +79,24 @@
person = Employee.byLastName("Leader")
assert person.firstName == "Project"
+ persons = list(InheritablePerson.select(orderBy=InheritablePerson.q.lastName))
+ assert len(persons) == 2
+
+ persons = list(InheritablePerson.select(orderBy=(InheritablePerson.q.lastName, InheritablePerson.q.firstName)))
+ assert len(persons) == 2
+
+ persons = list(Employee.select(orderBy=Employee.q.lastName))
+ assert len(persons) == 1
+
+ persons = list(Employee.select(orderBy=(Employee.q.lastName, Employee.q.firstName)))
+ assert len(persons) == 1
+
+ persons = list(Employee.select(orderBy=Employee.q.position))
+ assert len(persons) == 1
+
+ persons = list(Employee.select(orderBy=(Employee.q.position, Employee.q.lastName)))
+ assert len(persons) == 1
+
def test_addDelColumn():
setup()
Copied: home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance_tree.py (from rev 2239, SQLObject/trunk/sqlobject/inheritance/tests/test_inheritance_tree.py)
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance_tree.py (rev 0)
+++ home/phd/SQLObject/paramstyles/sqlobject/inheritance/tests/test_inheritance_tree.py 2007-01-23 18:02:01 UTC (rev 2240)
@@ -0,0 +1,37 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## Inheritance Tree
+########################################
+
+class Tree1(InheritableSQLObject):
+ aprop = StringCol(length=10)
+
+class Tree2(Tree1):
+ bprop = StringCol(length=10)
+
+class Tree3(Tree1):
+ cprop = StringCol(length=10)
+
+class Tree4(Tree2):
+ dprop = StringCol(length=10)
+
+class Tree5(Tree2):
+ eprop = StringCol(length=10)
+
+def test_tree():
+ setupClass([Tree1, Tree2, Tree3, Tree4, Tree5])
+
+ t1 = Tree1(aprop='t1')
+ t2 = Tree2(aprop='t2', bprop='t2')
+ t3 = Tree3(aprop='t3', cprop='t3')
+ t4 = Tree4(aprop='t4', bprop='t4', dprop='t4')
+ t5 = Tree5(aprop='t5', bprop='t5', eprop='t5')
+
+ # find just the t5 out of childs from Tree2
+ assert t5 == Tree1.select(Tree2.q.childName == 'Tree5')[0]
+
+ # t2,t4,t5 are all subclasses of Tree1 with t1 childName of 'Tree2'
+ assert list(Tree1.select(Tree1.q.childName == 'Tree2', orderBy="aprop")) == [t2, t4, t5]
Modified: home/phd/SQLObject/paramstyles/sqlobject/versioning/__init__.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/versioning/__init__.py 2007-01-23 17:14:51 UTC (rev 2239)
+++ home/phd/SQLObject/paramstyles/sqlobject/versioning/__init__.py 2007-01-23 18:02:01 UTC (rev 2240)
@@ -7,6 +7,8 @@
del values['id']
del values['masterID']
del values['dateArchived']
+ for col in self.extraCols:
+ del values[col]
self.masterClass.get(self.masterID).set(**values)
def nextVersion(self):
@@ -33,6 +35,12 @@
return super(Version, cls).select(clause, *args, **kw)
select = classmethod(select)
+ def __getattr__(self, attr):
+ if self.__dict__.has_key(attr):
+ return self.__dict__[attr]
+ else:
+ return getattr(self.master, attr)
+
def getColumns(columns, cls):
for column, defi in cls.sqlmeta.columnDefinitions.items():
if column.endswith("ID") and isinstance(defi, ForeignKey):
@@ -59,6 +67,7 @@
attrs = {'dateArchived': DateTimeCol(default=datetime.now),
'master': ForeignKey(self.soClass.__name__),
'masterClass' : self.soClass,
+ 'extraCols' : self.extraCols
}
getColumns (attrs, self.soClass)
@@ -69,6 +78,9 @@
(Version,),
attrs)
+ if '_connection' in self.soClass.__dict__:
+ self.versionClass._connection = self.soClass.__dict__['_connection']
+
events.listen(self.createTable,
soClass, events.CreateTableSignal)
events.listen(self.rowUpdate, soClass,
Modified: home/phd/SQLObject/paramstyles/sqlobject/versioning/test/test_version.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/versioning/test/test_version.py 2007-01-23 17:14:51 UTC (rev 2239)
+++ home/phd/SQLObject/paramstyles/sqlobject/versioning/test/test_version.py 2007-01-23 18:02:01 UTC (rev 2240)
@@ -121,6 +121,13 @@
assert monarchy.name == "USA"
assert monarchy.monarch == "Emperor Norton I"
+ extra = Extra(name='fleem')
+ extra.set(name='morx')
+ assert extra.name == "morx"
+ extra.versions[0].restore()
+ assert extra.name == "fleem"
+
+
def test_next():
setup()
base = Base(name='first', value=1)
|
|
From: SourceForge.net <no...@so...> - 2007-01-23 17:59:47
|
Bugs item #1642143, was opened at 2007-01-23 07:07 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1642143&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: SQLObject from repository >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: Leandro Lucarella (llucax) Assigned to: Oleg Broytmann (phd) Summary: [PATCH] TypeError:unhashable instance using sqlbuilder.Table Initial Comment: Hi! Maybe this is a pretty weird use case (please let me know if there is a better way to do this). What I wanted was just to store an ordered list of many-to-many relationships. To achieve this, I used an special intermediate table with an extra field for ordering. Then I write some custom SQL queries to do the join using sqlbuilder.table (Table instance) and friends. The problem is I'm getting a TypeError ("TypeError: unhashable instance") when doing that, because Table and Field don't have the __hash__ magic method (and for the records, none SQLExpression does either). Well, long story short, this is fixed by just adding the __hash__ method to SQLExpression class. Here is the patch and a simple testcase. Again, please tell me if there is a cleaner way to achieve this with SQLObject. Thanks! ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2007-01-23 20:59 Message: Logged In: YES user_id=4799 Originator: NO No need to make SQLExpresshion hashable. You problem must be fixed this way: clauseTables=("task_plan", Plan.sqlmeta.table), clauseTables must be a sequence of tables names (strings), not objects. ---------------------------------------------------------------------- Comment By: Leandro Lucarella (llucax) Date: 2007-01-23 15:29 Message: Logged In: YES user_id=240225 Originator: YES I know I can create the intermediate table using SQLObject, but I don't want to, because this generates an extra 'id' field in the table that is useless. What I really wanted to do was add an "OrderedRelatedJoin" or something like that but I got lost because RelatedJoin is so tied up with dbconnection module. I expected to be just plan (sqlbuilder) SQL in the join module. Another simple solution (but I think not too easy to implement because AFAIK SQLObject is to tied up too to the single primary key) is to let a SQLObject to have a composed primary key and use the two FK as the PK. Anyways, I'm not using the Table object as dict, SQLObject is =) If you run the testcase, you'll get: Traceback (most recent call last): File "testcase.py", line 70, in ? plan.tasks = (Task(name="task1"), Task(name="task2"), Task(name="task3")) File "testcase.py", line 48, in _set_tasks old = frozenset([t.id for t in self.tasks]) File "testcase.py", line 38, in _get_tasks orderBy=task_plan_table.pos, File "/tmp/0.8/sqlobject/main.py", line 1347, in select join=join, forUpdate=forUpdate) File "/tmp/0.8/sqlobject/sresults.py", line 20, in __init__ tablesDict[table] = 1 TypeError: unhashable instance I know I could use plain old strings instead of the Table object instance, but I found the later more pythonic (I feel like I'm not messing arround with raw SQL =D). And BTW, it's a very simple patch (3 lines of code, it's 'def __has__(self): return hash(str(self))' inside SQLExpression class declaration. It couldn't hurt anybody. And as plus it completes a little more the SQLExpression in general so you can use SQLExpressions as dict keys in general. PS. Sorry about the patch, I've posted some others in the past here and nobody complained, maybe there was a change in the policy, that was about... 2 years ago. Damn! The time pass by... ;-P ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2007-01-23 12:46 Message: Logged In: YES user_id=4799 Originator: NO First, you don't need to create the intermediate table yourself. The development FAQ shows how to do this in SQLObject: http://sqlobject.org/devel/FAQ.html#how-can-i-define-my-own-intermediate-table-in-my-many-to-many-relationship Second, I do not understand where from came the TypeError. Are you trying to use Tables as a dict keys? PS. Patches should be put in patches, really. ;) ---------------------------------------------------------------------- Comment By: Leandro Lucarella (llucax) Date: 2007-01-23 07:11 Message: Logged In: YES user_id=240225 Originator: YES The patch apply cleanly to the 0.8 branch too. I hope it make it to 0.8 =) ---------------------------------------------------------------------- Comment By: Leandro Lucarella (llucax) Date: 2007-01-23 07:09 Message: Logged In: YES user_id=240225 Originator: YES File Added: sqlexpression.hash.patch ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1642143&group_id=74338 |
|
From: <sub...@co...> - 2007-01-23 17:15:09
|
Author: phd Date: 2007-01-23 10:14:51 -0700 (Tue, 23 Jan 2007) New Revision: 2239 Modified: SQLObject/docs/News.txt Log: Fixed a bug in deep Inheritance tree. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2007-01-23 17:13:55 UTC (rev 2238) +++ SQLObject/docs/News.txt 2007-01-23 17:14:51 UTC (rev 2239) @@ -162,6 +162,8 @@ * Remove a leading slash in FirebirdConnection. +* Fixed a bug in deep Inheritance tree. + SQLObject 0.7.2 =============== |
|
From: <sub...@co...> - 2007-01-23 17:14:10
|
Author: phd
Date: 2007-01-23 10:13:55 -0700 (Tue, 23 Jan 2007)
New Revision: 2238
Added:
SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/test_inheritance_tree.py
Modified:
SQLObject/branches/0.7-bugfix/docs/News.txt
SQLObject/branches/0.7-bugfix/sqlobject/main.py
Log:
Fixed a bug in deep Inheritance tree (ticket:288).
Modified: SQLObject/branches/0.7-bugfix/docs/News.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/News.txt 2007-01-23 17:11:12 UTC (rev 2237)
+++ SQLObject/branches/0.7-bugfix/docs/News.txt 2007-01-23 17:13:55 UTC (rev 2238)
@@ -26,6 +26,8 @@
* Remove a leading slash in FirebirdConnection.
+* Fixed a bug in deep Inheritance tree.
+
SQLObject 0.7.2
===============
Added: SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/test_inheritance_tree.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/test_inheritance_tree.py (rev 0)
+++ SQLObject/branches/0.7-bugfix/sqlobject/inheritance/tests/test_inheritance_tree.py 2007-01-23 17:13:55 UTC (rev 2238)
@@ -0,0 +1,37 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## Inheritance Tree
+########################################
+
+class Tree1(InheritableSQLObject):
+ aprop = StringCol(length=10)
+
+class Tree2(Tree1):
+ bprop = StringCol(length=10)
+
+class Tree3(Tree1):
+ cprop = StringCol(length=10)
+
+class Tree4(Tree2):
+ dprop = StringCol(length=10)
+
+class Tree5(Tree2):
+ eprop = StringCol(length=10)
+
+def test_tree():
+ setupClass([Tree1, Tree2, Tree3, Tree4, Tree5])
+
+ t1 = Tree1(aprop='t1')
+ t2 = Tree2(aprop='t2', bprop='t2')
+ t3 = Tree3(aprop='t3', cprop='t3')
+ t4 = Tree4(aprop='t4', bprop='t4', dprop='t4')
+ t5 = Tree5(aprop='t5', bprop='t5', eprop='t5')
+
+ # find just the t5 out of childs from Tree2
+ assert t5 == Tree1.select(Tree2.q.childName == 'Tree5')[0]
+
+ # t2,t4,t5 are all subclasses of Tree1 with t1 childName of 'Tree2'
+ assert list(Tree1.select(Tree1.q.childName == 'Tree2', orderBy="aprop")) == [t2, t4, t5]
Modified: SQLObject/branches/0.7-bugfix/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/main.py 2007-01-23 17:11:12 UTC (rev 2237)
+++ SQLObject/branches/0.7-bugfix/sqlobject/main.py 2007-01-23 17:13:55 UTC (rev 2238)
@@ -804,6 +804,8 @@
currentClass = currentClass._parentClass
for column in currentClass.sqlmeta.columnDefinitions.values():
if type(column) == col.ForeignKey: continue
+ if column.name == 'childName':
+ continue
setattr(cls.q, column.name,
getattr(currentClass.q, column.name))
|
|
From: <sub...@co...> - 2007-01-23 17:12:04
|
Author: phd Date: 2007-01-23 10:11:12 -0700 (Tue, 23 Jan 2007) New Revision: 2237 Added: SQLObject/branches/0.8/sqlobject/inheritance/tests/test_inheritance_tree.py Log: Added test_inheritance_tree.py. Added: SQLObject/branches/0.8/sqlobject/inheritance/tests/test_inheritance_tree.py =================================================================== --- SQLObject/branches/0.8/sqlobject/inheritance/tests/test_inheritance_tree.py (rev 0) +++ SQLObject/branches/0.8/sqlobject/inheritance/tests/test_inheritance_tree.py 2007-01-23 17:11:12 UTC (rev 2237) @@ -0,0 +1,37 @@ +from sqlobject import * +from sqlobject.inheritance import * +from sqlobject.tests.dbtest import * + +######################################## +## Inheritance Tree +######################################## + +class Tree1(InheritableSQLObject): + aprop = StringCol(length=10) + +class Tree2(Tree1): + bprop = StringCol(length=10) + +class Tree3(Tree1): + cprop = StringCol(length=10) + +class Tree4(Tree2): + dprop = StringCol(length=10) + +class Tree5(Tree2): + eprop = StringCol(length=10) + +def test_tree(): + setupClass([Tree1, Tree2, Tree3, Tree4, Tree5]) + + t1 = Tree1(aprop='t1') + t2 = Tree2(aprop='t2', bprop='t2') + t3 = Tree3(aprop='t3', cprop='t3') + t4 = Tree4(aprop='t4', bprop='t4', dprop='t4') + t5 = Tree5(aprop='t5', bprop='t5', eprop='t5') + + # find just the t5 out of childs from Tree2 + assert t5 == Tree1.select(Tree2.q.childName == 'Tree5')[0] + + # t2,t4,t5 are all subclasses of Tree1 with t1 childName of 'Tree2' + assert list(Tree1.select(Tree1.q.childName == 'Tree2', orderBy="aprop")) == [t2, t4, t5] |
|
From: <sub...@co...> - 2007-01-23 17:11:09
|
Author: phd Date: 2007-01-23 10:10:57 -0700 (Tue, 23 Jan 2007) New Revision: 2236 Added: SQLObject/trunk/sqlobject/inheritance/tests/test_inheritance_tree.py Log: Added test_inheritance_tree.py. Added: SQLObject/trunk/sqlobject/inheritance/tests/test_inheritance_tree.py =================================================================== --- SQLObject/trunk/sqlobject/inheritance/tests/test_inheritance_tree.py (rev 0) +++ SQLObject/trunk/sqlobject/inheritance/tests/test_inheritance_tree.py 2007-01-23 17:10:57 UTC (rev 2236) @@ -0,0 +1,37 @@ +from sqlobject import * +from sqlobject.inheritance import * +from sqlobject.tests.dbtest import * + +######################################## +## Inheritance Tree +######################################## + +class Tree1(InheritableSQLObject): + aprop = StringCol(length=10) + +class Tree2(Tree1): + bprop = StringCol(length=10) + +class Tree3(Tree1): + cprop = StringCol(length=10) + +class Tree4(Tree2): + dprop = StringCol(length=10) + +class Tree5(Tree2): + eprop = StringCol(length=10) + +def test_tree(): + setupClass([Tree1, Tree2, Tree3, Tree4, Tree5]) + + t1 = Tree1(aprop='t1') + t2 = Tree2(aprop='t2', bprop='t2') + t3 = Tree3(aprop='t3', cprop='t3') + t4 = Tree4(aprop='t4', bprop='t4', dprop='t4') + t5 = Tree5(aprop='t5', bprop='t5', eprop='t5') + + # find just the t5 out of childs from Tree2 + assert t5 == Tree1.select(Tree2.q.childName == 'Tree5')[0] + + # t2,t4,t5 are all subclasses of Tree1 with t1 childName of 'Tree2' + assert list(Tree1.select(Tree1.q.childName == 'Tree2', orderBy="aprop")) == [t2, t4, t5] |
|
From: <sub...@co...> - 2007-01-23 16:28:35
|
Author: phd
Date: 2007-01-23 09:28:19 -0700 (Tue, 23 Jan 2007)
New Revision: 2235
Added:
SQLObject/branches/0.8/sqlobject/inheritance/tests/test_aggregates.py
Modified:
SQLObject/branches/0.8/sqlobject/inheritance/__init__.py
Log:
Fixed aggregators and accumulators with inheritance.
Modified: SQLObject/branches/0.8/sqlobject/inheritance/__init__.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/inheritance/__init__.py 2007-01-23 16:27:02 UTC (rev 2234)
+++ SQLObject/branches/0.8/sqlobject/inheritance/__init__.py 2007-01-23 16:28:19 UTC (rev 2235)
@@ -19,7 +19,6 @@
elif isinstance(obj, (tuple, list)):
d = {}
for component in obj:
- print component
d.update(tablesUsedDict(component))
return d
else:
@@ -29,12 +28,16 @@
class InheritableSelectResults(SelectResults):
IterationClass = iteration.InheritableIteration
- def __init__(self, sourceClass, clause, clauseTables=None, **ops):
+ def __init__(self, sourceClass, clause, clauseTables=None,
+ inheritedTables=None, **ops):
if clause is None or isinstance(clause, str) and clause == 'all':
clause = sqlbuilder.SQLTrueClause
tablesDict = tablesUsedDict(clause)
tablesDict[sourceClass.sqlmeta.table] = 1
orderBy = ops.get('orderBy')
+ if inheritedTables:
+ for tableName in inheritedTables:
+ tablesDict[tableName] = 1
if orderBy and not isinstance(orderBy, basestring):
tablesDict.update(tablesUsedDict(orderBy))
#DSM: if this class has a parent, we need to link it
@@ -81,6 +84,16 @@
super(InheritableSelectResults, self).__init__(sourceClass,
clause, clauseTables, **ops)
+ def accumulateMany(self, *attributes, **kw):
+ if kw.get("skipInherited"):
+ return super(InheritableSelectResults, self).accumulateMany(*attributes)
+ tables = []
+ for func_name, attribute in attributes:
+ if not isinstance(attribute, basestring):
+ tables.append(attribute.tableName)
+ clone = self.__class__(self.sourceClass, self.clause,
+ self.clauseTables, inheritedTables=tables, **self.ops)
+ return clone.accumulateMany(skipInherited=True, *attributes)
class InheritableSQLMeta(sqlmeta):
def addColumn(sqlmeta, columnDef, changeSchema=False, connection=None, childUpdate=False):
Copied: SQLObject/branches/0.8/sqlobject/inheritance/tests/test_aggregates.py (from rev 2233, SQLObject/trunk/sqlobject/inheritance/tests/test_aggregates.py)
===================================================================
--- SQLObject/branches/0.8/sqlobject/inheritance/tests/test_aggregates.py (rev 0)
+++ SQLObject/branches/0.8/sqlobject/inheritance/tests/test_aggregates.py 2007-01-23 16:28:19 UTC (rev 2235)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestAggregate1(InheritableSQLObject):
+ value1 = IntCol()
+
+class TestAggregate2(TestAggregate1):
+ value2 = IntCol()
+
+def test_aggregates():
+ setupClass([TestAggregate1, TestAggregate2])
+
+ TestAggregate1(value1=1)
+ TestAggregate2(value1=2, value2=12)
+
+ assert TestAggregate1.select().max("value1") == 2
+ assert TestAggregate2.select().max("value1") == 2
+ raises(Exception, TestAggregate2.select().max, "value2")
+ assert TestAggregate2.select().max(TestAggregate2.q.value2) == 12
|
|
From: <sub...@co...> - 2007-01-23 16:27:20
|
Author: phd Date: 2007-01-23 09:27:02 -0700 (Tue, 23 Jan 2007) New Revision: 2234 Modified: SQLObject/docs/News.txt Log: Fixed aggregators and accumulators with inheritance. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2007-01-23 16:24:31 UTC (rev 2233) +++ SQLObject/docs/News.txt 2007-01-23 16:27:02 UTC (rev 2234) @@ -141,6 +141,8 @@ * Order by several columns with inheritance. +* Fixed aggregators and accumulators with inheritance. + SQLObject 0.7.3 =============== |
|
From: <sub...@co...> - 2007-01-23 16:24:53
|
Author: phd
Date: 2007-01-23 09:24:31 -0700 (Tue, 23 Jan 2007)
New Revision: 2233
Added:
SQLObject/trunk/sqlobject/inheritance/tests/test_aggregates.py
Modified:
SQLObject/trunk/sqlobject/inheritance/__init__.py
Log:
Fixed aggregators and accumulators with inheritance.
Modified: SQLObject/trunk/sqlobject/inheritance/__init__.py
===================================================================
--- SQLObject/trunk/sqlobject/inheritance/__init__.py 2007-01-23 15:16:43 UTC (rev 2232)
+++ SQLObject/trunk/sqlobject/inheritance/__init__.py 2007-01-23 16:24:31 UTC (rev 2233)
@@ -19,7 +19,6 @@
elif isinstance(obj, (tuple, list)):
d = {}
for component in obj:
- print component
d.update(tablesUsedDict(component))
return d
else:
@@ -29,12 +28,16 @@
class InheritableSelectResults(SelectResults):
IterationClass = iteration.InheritableIteration
- def __init__(self, sourceClass, clause, clauseTables=None, **ops):
+ def __init__(self, sourceClass, clause, clauseTables=None,
+ inheritedTables=None, **ops):
if clause is None or isinstance(clause, str) and clause == 'all':
clause = sqlbuilder.SQLTrueClause
tablesDict = tablesUsedDict(clause)
tablesDict[sourceClass.sqlmeta.table] = 1
orderBy = ops.get('orderBy')
+ if inheritedTables:
+ for tableName in inheritedTables:
+ tablesDict[tableName] = 1
if orderBy and not isinstance(orderBy, basestring):
tablesDict.update(tablesUsedDict(orderBy))
#DSM: if this class has a parent, we need to link it
@@ -81,6 +84,16 @@
super(InheritableSelectResults, self).__init__(sourceClass,
clause, clauseTables, **ops)
+ def accumulateMany(self, *attributes, **kw):
+ if kw.get("skipInherited"):
+ return super(InheritableSelectResults, self).accumulateMany(*attributes)
+ tables = []
+ for func_name, attribute in attributes:
+ if not isinstance(attribute, basestring):
+ tables.append(attribute.tableName)
+ clone = self.__class__(self.sourceClass, self.clause,
+ self.clauseTables, inheritedTables=tables, **self.ops)
+ return clone.accumulateMany(skipInherited=True, *attributes)
class InheritableSQLMeta(sqlmeta):
def addColumn(sqlmeta, columnDef, changeSchema=False, connection=None, childUpdate=False):
Added: SQLObject/trunk/sqlobject/inheritance/tests/test_aggregates.py
===================================================================
--- SQLObject/trunk/sqlobject/inheritance/tests/test_aggregates.py (rev 0)
+++ SQLObject/trunk/sqlobject/inheritance/tests/test_aggregates.py 2007-01-23 16:24:31 UTC (rev 2233)
@@ -0,0 +1,20 @@
+from sqlobject import *
+from sqlobject.inheritance import *
+from sqlobject.tests.dbtest import *
+
+class TestAggregate1(InheritableSQLObject):
+ value1 = IntCol()
+
+class TestAggregate2(TestAggregate1):
+ value2 = IntCol()
+
+def test_aggregates():
+ setupClass([TestAggregate1, TestAggregate2])
+
+ TestAggregate1(value1=1)
+ TestAggregate2(value1=2, value2=12)
+
+ assert TestAggregate1.select().max("value1") == 2
+ assert TestAggregate2.select().max("value1") == 2
+ raises(Exception, TestAggregate2.select().max, "value2")
+ assert TestAggregate2.select().max(TestAggregate2.q.value2) == 12
|