def addaddress(self): longitude = self.request.get("lon") latitude = self.request.get("lat") if longitude != "" and latitude != "": location = db.GeoPt(latitude, longitude) else: location = None countryCode = self.getRequiredParameter('country') if countryCode == "Country": countryCode = "" userAddress = UserAddress(parent = self.userProfile, address = self.getRequiredParameter('address'), city = self.getRequiredParameter('city'), countryCode = countryCode, postalCode = self.request.get('postal'), privacyType = self.getRequiredParameter('privacy'), location = location) userAddress.put() # Add permissions for this email in every outgoing group for persona in self.userProfile.personas: permitAddress = PermitAddress(parent = persona, userAddress = userAddress) permitAddress.put() self._updateAllVCards() self.sendJsonOK({'key': str(userAddress.key())})
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")