Skip to content

Commit

Permalink
with better iterbetter, bool test can be done on sqlite results too
Browse files Browse the repository at this point in the history
  • Loading branch information
anandology committed Nov 4, 2009
1 parent fa655ca commit 9e5e404
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions test/db.py
Expand Up @@ -99,6 +99,11 @@ def test_result_is_unicode(self):
name = db.select('person')[0].name
self.assertEquals(type(name), unicode)

def test_result_is_true(self):
db = webtest.setup_database(self.dbname)
self.db.insert('person', False, name='user')
self.assertEquals(bool(db.select('person')), True)

def testBoolean(self):
def t(active):
name ='name-%s' % active
Expand Down
4 changes: 0 additions & 4 deletions web/db.py
Expand Up @@ -966,11 +966,7 @@ def _process_insert_query(self, query, tablename, seqname):
def query(self, *a, **kw):
out = DB.query(self, *a, **kw)
if isinstance(out, iterbetter):
# rowcount is not provided by sqlite
def _nonzero():
raise self.db_module.NotSupportedError("rowcount is not supported by sqlite")
del out.__len__
out.__nonzero__ = _nonzero
return out

class FirebirdDB(DB):
Expand Down

0 comments on commit 9e5e404

Please sign in to comment.