Separate toggler from checker

This commit is contained in:
Klaus-Uwe Mitterer 2017-02-08 15:26:21 +01:00
parent 43850de706
commit 3cb5d8861c

View file

@ -85,11 +85,8 @@ class dbObject:
except:
return False
def toggleTweet(self, cid):
def getTStatus(self, cid):
try:
self.executeQuery("UPDATE tokens SET tweet = NOT tweet WHERE cid = %i;" % int(cid))
self.commit()
self.executeQuery("SELECT tweet FROM tokens WHERE cid = %i;" % int(cid))
return True if self.cur.fetchone()[0] == 1 else False
@ -97,6 +94,12 @@ class dbObject:
except:
raise ValueError("No such user: %i" % int(cid))
def toggleTweet(self, cid):
self.executeQuery("UPDATE tokens SET tweet = NOT tweet WHERE cid = %i;" % int(cid))
self.commit()
return getTStatus
def addFish(self, cid):
self.executeQuery("UPDATE tokens SET fish = fish + 1 WHERE cid = %i;" % int(cid))
self.commit()