예제 #1
0
파일: Profile.py 프로젝트: kradecki/psinque
    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())})