Convert generator to list for getFollowers()/getFollowing()

Fix SQL query in getFollowing()
This commit is contained in:
Klaus-Uwe Mitterer 2016-08-05 23:20:18 +02:00
parent 98afc3bffd
commit 21c90eb394

View file

@ -51,7 +51,7 @@ def getMessages(db=dbtools.dbHelper(), two=twitools.twObject()):
return mcount, savepoint or 0, db.getLatestMessage()
def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False):
current = db.getFollowers()
current = list(db.getFollowers())
new = list(twitools.getNamesByIDs(twitools.getFollowerIDs()))
gained = 0
lost = 0
@ -77,7 +77,7 @@ def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False)
return gained, lost
def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False):
current = db.getFollowing()
current = list(db.getFollowing())
new = list(twitools.getNamesByIDs(twitools.getFollowingIDs()))
gained = 0
lost = 0
@ -94,7 +94,7 @@ def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False)
for following in current:
if following not in new:
db.executeQuery("UPDATE following SET `until` = %i WHERE `id` = %s AND `until` IS NULL" % (int(time.time()), following))
db.executeQuery("UPDATE following SET `until` = %i WHERE `id` = '%s' AND `until` IS NULL" % (int(time.time()), following))
print("You no longer follow: %s" % following)
lost += 1