Commits

Jun Omae  committed 7992145

removed unnecessary calls of `.fetchall()` and an unused `cursor` variable

  • Participants
  • Parent commits f333647

Comments (0)

Files changed (1)

File trac/notification/model.py

     @classmethod
     def update_format_by_distributor_and_sid(cls, env, distributor, sid, authenticated, format):
         with env.db_transaction as db:
-            cursor = db.cursor()
             db("""
             UPDATE subscription
                SET format=%s
                  AND distributor=%s
             ORDER BY priority
             """, (sid,int(authenticated),distributor))
-            for i in cursor.fetchall():
+            for i in cursor:
                 sub = Subscription(env)
                 sub['id'] = i[0]
                 sub['sid'] = i[1]
                        AND sid = %s
                        AND authenticated = %s
                 """, (klass,sid,int(authenticated)))
-                for i in cursor.fetchall():
+                for i in cursor:
                     sub = Subscription(env)
                     sub['id'] = i[0]
                     sub['sid'] = i[1]
                   FROM subscription
                  WHERE class=%s
             """, (klass,))
-            for i in cursor.fetchall():
+            for i in cursor:
                 sub = Subscription(env)
                 sub['id'] = i[0]
                 sub['sid'] = i[1]