def save_users(names, group=None): members, users = [], [] if group: members = group.members users = get_users(group) for name in names: for user in users: if name == user.name: break else: user = UserAlias(name=name) user.put() members.append(user.key().id()) return members
def get_user(id): try: return UserAlias.get_by_id(long(id)) except: return None
def get_users(group): users = [] for member_id in group.members: users.append(UserAlias.get_by_id(member_id)) return users