Exemplo n.º 1
0
 def removeFriendRequest(self, username, otherUsername):
     oldFriendRequests = self.getFriendRequestsForUser(username)
     if (oldFriendRequests == [(None,)]):
         newFriendRequestList = ""
     else:
         csv = oldFriendRequests[0][0].split(",")
         csv.remove(otherUsername)
         newFriendRequestList = listToCsvString(csv)
     return self.writeQuery("""update users set friend_requests = '{friend_requests}'""".format(friend_requests = newFriendRequestList))
Exemplo n.º 2
0
 def removeFriendRequest(self, username, otherUsername):
     oldFriendRequests = self.getFriendRequestsForUser(username)
     if (oldFriendRequests == [(None, )]):
         newFriendRequestList = ""
     else:
         csv = oldFriendRequests[0][0].split(",")
         csv.remove(otherUsername)
         newFriendRequestList = listToCsvString(csv)
     return self.writeQuery(
         """update users set friend_requests = '{friend_requests}'""".
         format(friend_requests=newFriendRequestList))
Exemplo n.º 3
0
 def removeFriend(self,username,friend):
     oldFriendsCsv = self.getFriendsForUser(username)
     if (oldFriendsCsv == [(None,)] or oldFriendsCsv == [("",)]):
         oldFriends = []
     else:
         oldFriends = oldFriendsCsv[0][0].split(",")
     if (friend in oldFriends):
         oldFriends.remove(friend)
     else:
         print("~" + username + "~ is not friends with ~" + friend + "~")
         return None
     newFriends = listToCsvString(oldFriends)
     return self.writeQuery("""update users set friends = '{friends}' where username = '******'""".format(friends = newFriends, username = username))
Exemplo n.º 4
0
 def removeFriend(self, username, friend):
     oldFriendsCsv = self.getFriendsForUser(username)
     if (oldFriendsCsv == [(None, )] or oldFriendsCsv == [("", )]):
         oldFriends = []
     else:
         oldFriends = oldFriendsCsv[0][0].split(",")
     if (friend in oldFriends):
         oldFriends.remove(friend)
     else:
         print("~" + username + "~ is not friends with ~" + friend + "~")
         return None
     newFriends = listToCsvString(oldFriends)
     return self.writeQuery(
         """update users set friends = '{friends}' where username = '******'"""
         .format(friends=newFriends, username=username))