commit | 58b57a4257d1c1cf34a626d4540c161f4bbc1eab | [log] [tgz] |
---|---|---|
author | Steve McIntyre <steve.mcintyre@linaro.org> | Tue Dec 02 13:09:21 2014 +0000 |
committer | Steve McIntyre <steve.mcintyre@linaro.org> | Tue Dec 02 13:09:21 2014 +0000 |
tree | d36c2b3fe6f1b948040474a3bd33fd25fc49aa0c | |
parent | eed211de3c529898137afe9f427b5f70a0b51e66 [diff] [blame] |
Use rowcount rather than exceptions on fetchone()[] Change-Id: Ibc844f7e32786182ea33a7a658b751525fd13f95
diff --git a/db/db.py b/db/db.py index b19b616..c3a9f86 100644 --- a/db/db.py +++ b/db/db.py
@@ -165,10 +165,9 @@ data = (value, ) self.cursor.execute(sql, data) - try: - result = self.cursor.fetchone()[0] - return result - except TypeError: + if self.cursor.rowcount > 0: + return self.cursor.fetchone()[0] + else: return None def get_switch_id(self, name):