twissandra/twissandra — Issue #15: Error in remove_friends(from_username, to_usernames) method
Author: RobertaFerrari
Created: 2011-10-27 15:07:15+00:00
State: open

During my thesis degree i found some errors in the remove_friends() method.
Follows the patch:

-------------------------------------- start patch --------------------------------------

--- cass.py	2011-10-27 07:26:47.045890101 -0700
+++ cass_new.py	2011-10-27 07:55:47.673890406 -0700
@@ -233,9 +233,13 @@
def remove_friends(from_username, to_usernames):
"""
Removes a friendship relationship from one user to some others.
+ patched by Ferrari Roberta and Pozzato Gian Luca
"""
- for username in to_usernames:
- FRIENDS.remove(str(from_username), column=str(username))
- for to_username in to_usernames:
- FOLLOWERS.remove(str(to_username), column=str(to_username))
-
+ # for username in to_usernames:
+ ts = str(int(time.time() * 1e6))
+ dct = pycassa.util.OrderedDict(((str(username), ts) for username in to_usernames))
+ FRIENDS.remove(str(from_username), columns=dct)
+
+ for to_username in to_usernames:
+ FOLLOWERS.remove(str(to_username), columns={str(from_username): ts})
+

-------------------------------------- end patch --------------------------------------
For more information feel free to contact me @ roby.ferrari86@gmail.com
bye