Fix profile merge code on login, add test.

This commit is contained in:
Ian Gulliver
2014-05-16 22:35:20 +03:00
parent 64e16e7ec1
commit 81d7db3678
2 changed files with 54 additions and 11 deletions

View File

@@ -49,12 +49,14 @@ class Profile(db.Model):
profile.put()
return profile
@db.transactional(xg=True)
def MergeFrom(self, source_profile):
# Merge from another profile into this one, using last_set time as the
# arbiter.
# TODO: this is totally broken
pass
# This is non-transactional and racy (new messages can be introduced by the
# old client after we start). This is hard to solve because a) we're not in
# a single hierarchy and b) we don't revoke the old client ID, so it can
# still be used.
for message in Message.all().filter('sender =', source_profile):
message.sender = self;
message.put()
class Client(db.Model):