[SQLObject] Bug in CVS: .select() and dot q magic
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Brad B. <br...@bb...> - 2003-10-14 20:11:29
|
Hi, So, in running off the bleeding edge version of CVS, the two-FK's-in-A-pointing-to-the-same-B problem went away, but (literally) all my tests broke. :/ The culprit is illustrated by the following snippet: bradb@xdev200:~/1ave/merchant/lib/tests$ python Python 2.2.3 (#1, Jun 13 2003, 18:46:44) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from SQLObject import * >>> __connection__ = PostgresConnection( ... host = 'localhost', ... db = 'foobar', ... user = 'foobar', ... passwd = 'foobar' ... ) >>> class FooBar(SQLObject): ... foo = StringCol() ... >>> FooBar.createTable() >>> f = FooBar.new(foo = 'test') >>> FooBar.select(FooBar.q.foo == 'test') <SQLObject.SQLObject.SelectResults object at 0x82adb6c> >>> list(FooBar.select(FooBar.q.foo == 'test')) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/home/bradb/src/Python/modules/SQLObject/DBConnection.py", line 165, in _iterSelect query = self.queryForSelect(select) File "/home/bradb/src/Python/modules/SQLObject/DBConnection.py", line 207, in queryForSelect return self._addWhereClause(select, q) File "/home/bradb/src/Python/modules/SQLObject/DBConnection.py", line 211, in _addWhereClause q = str(select.clause) File "/home/bradb/src/Python/modules/SQLObject/SQLBuilder.py", line 157, in __str__ return self.__sqlrepr__(None) File "/home/bradb/src/Python/modules/SQLObject/SQLBuilder.py", line 221, in __sqlrepr__ return "(%s %s %s)" % (sqlrepr(self.expr1, db), self.op, sqlrepr(self.expr2, db)) File "/home/bradb/src/Python/modules/SQLObject/Converters.py", line 170, in sqlrepr return converter(obj, db) File "/home/bradb/src/Python/modules/SQLObject/Converters.py", line 92, in StringLikeConverter assert 0, "Database %s unknown" % db AssertionError: Database None unknown FWIW, I did the same test as above with an IntCol and it worked fine. -- Brad Bollenbach BBnet.ca |