def get(self, uuid): invite = InviteCode.gql("WHERE uuid=:1", uuid).get() if invite == None: logging.error("invite not found: " + uuid) self.error(500) return if self.currentuser == None: self.currentuser = UserInfo(user=users.get_current_user()) self.currentuser.put() relationship = GroupUserInfo.gql("WHERE user=:1 AND group=:2", self.currentuser, invite.group).get() if relationship == None: relationship = GroupUserInfo(user=self.currentuser, group=invite.group, groupname=invite.group.shortname) relationship.put() invite.delete() if is_empty(self.currentuser.nickname): self.render('edit_profile') return self.redirect('/' + invite.group.shortname)
def delete_user(self, userId): group = self.currentgroup userToDelete = db.get(userId) if userToDelete != None and userToDelete.user != group.creator.user: relationship = GroupUserInfo.gql("WHERE user=:1 AND group=:2", userToDelete, group).get() if relationship != None: relationship.delete() return True return False