def groupList(userProfile): """Returns the list of all groups created by the logged in user. :returns: list -- the list of groups """ groupNames = [] for group in Group.all().ancestor(userProfile): if group.sync: groupNames.append(group.name) return groupNames
def friendList(userProfile, groupName): friendList = [] group = Group.all(). \ ancestor(userProfile). \ filter("name =", groupName). \ get() contacts = Contact.all(). \ ancestor(userProfile). \ filter("group =", group) for contact in contacts: friendList.append(str(contact.key()) + ".vcf") return friendList
def deleteProfile(userProfileKey): userProfile = UserProfile.get(userProfileKey) for e in CardDAVLogin.all().ancestor(userProfile): e.delete() for e in IndividualPermit.all().ancestor(userProfile): e.delete() for e in Persona.all().ancestor(userProfile): e.delete() for e in Psinque.all().ancestor(userProfile): e.delete() for e in Contact.all().ancestor(userProfile): e.delete() for e in Group.all().ancestor(userProfile): e.delete() for e in UserAddress.all().ancestor(userProfile): e.delete() for e in UserEmail.all().ancestor(userProfile): e.delete() for e in UserIM.all().ancestor(userProfile): e.delete() for e in UserPhoneNumber.all().ancestor(userProfile): e.delete() for e in UserPhoto.all().ancestor(userProfile): e.image.delete() e.delete() for e in UserNickname.all().ancestor(userProfile): e.delete() for e in UserCompany.all().ancestor(userProfile): e.delete() for e in UserWebpage.all().ancestor(userProfile): e.delete() if not userProfile.userSettings is None: userProfile.userSettings.delete() userProfile.delete() logging.info("User profile deleted")