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))
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))
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))
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))