Fix the use of rowcount because it can return -1 or None according to PEP249

This commit is contained in:
Cédric Krier
2009-07-07 19:37:19 +02:00
parent a44062babb
commit f73652cc5c
3 changed files with 2 additions and 4 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ class FiscalYear(ModelSQL, ModelView):
fiscalyear.end_date, fiscalyear.end_date,
fiscalyear.start_date, fiscalyear.end_date,
fiscalyear.company.id, fiscalyear.id))
if cursor.rowcount:
if cursor.fetchone():
return False
return True
-2
View File
@@ -165,8 +165,6 @@ class Party(ModelSQL, ModelView):
'AND'.join(['(SUM((COALESCE(l.debit, 0) - COALESCE(l.credit, 0))) ' \
+ ' ' + x[1] + ' %s) ' for x in args]),
[code] + today_value + [company_id] + [x[2] for x in args])
if not cursor.rowcount:
return [('id', '=', 0)]
return [('id', 'in', [x[0] for x in cursor.fetchall()])]
Party()
+1 -1
View File
@@ -85,7 +85,7 @@ class Period(ModelSQL, ModelView):
period.end_date, period.end_date,
period.start_date, period.end_date,
period.fiscalyear.id, period.id))
if cursor.rowcount:
if cursor.fetchone():
return False
return True