[SQLObject] Comparison with None fails with DBMConnection
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Chris A. <ch...@at...> - 2003-11-03 22:53:49
|
This code: from SQLObject import * conn = DBMConnection(".") class TestMe(SQLObject): _connection = conn testCol = StringCol(default = None) TestMe.dropTable(ifExists = True) TestMe.createTable(ifNotExists = True) t = TestMe.new() print list(TestMe.select(TestMe.q.testCol == None)) fails with this error: Traceback (most recent call last): File "test.py", line 14, in ? print list(TestMe.select(TestMe.q.testCol == None)) File "/usr/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 1216, in next if SQLBuilder.execute(self.select.clause, self): File "/usr/lib/python2.3/site-packages/SQLObject/SQLBuilder.py", line 81, in execute return expr.execute(executor) File "/usr/lib/python2.3/site-packages/SQLObject/SQLBuilder.py", line 243, in execute return operatorMap[self.op.upper()](execute(self.expr1, executor), KeyError: 'IS' I found that by adding '"IS": operator.eq' to operatorMap in SQLBuilder.py fixed this error, but I don't know if this will impact other DB connection types. Cheers, Chris -- Chris AtLee <ch...@at...> |