Use .first() instead of [0]... thanks elrond :)
authorChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 2 Jan 2012 19:59:36 +0000 (13:59 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 29 Jan 2012 22:33:45 +0000 (16:33 -0600)
mediagoblin/db/sql/util.py

index 4938bcad5829dccc30a68684f7750ad7d3956a5f..dfc36a61999756c115ef6b42c32be61737be9eea 100644 (file)
@@ -73,11 +73,8 @@ class MigrationManager(object):
         """
         Get the migration row associated with this object, if any.
         """
-        query = self.database.query(
-            self.migration_model).filter_by(name=self.name)[0]
-
-        if query.count():
-            return query[0]
+        return self.database.query(
+            self.migration_model).filter_by(name=self.name).first()
 
     def latest_migration(self):
         """