示例#1
0
    def addemail(self):

        email = self._checkNewItemByName(UserEmail, 'email')
        email = email.lower()

        userEmail = UserEmail(parent = self.userProfile,
                              itemValue = email,
                              privacyType = self.getRequiredParameter('privacy'),
                              primary = self.getRequiredBoolParameter('primary'))
        userEmail.put()

        # Add permissions for this email in every outgoing group
        for persona in self.userProfile.personas:
            permitEmail = PermitEmail(parent = persona,
                                      userEmail = userEmail)
            permitEmail.put()

        self._updateAllVCards()

        self.sendJsonOK({'key': str(userEmail.key())})