Пример #1
0
    def create_unconfirmed_user(self, user, send_email=False):
        # Creates a user whose account cannot be used without confirmation

        if User.all().filter('email =', user.email).count(limit=1) > 0:
            raise AlreadyExistsException()

        user.status = UserStatus.UNCONFIRMED
        user.confirmation_code = self._generate_confirmation_code()
        user.put()
        if send_email:
            self.email_service.send_user_confirmation_mail(user)
Пример #2
0
    def create_unconfirmed_user(self, user, send_email=False):
        # Creates a user whose account cannot be used without confirmation

        if User.all().filter('email =', user.email).count(limit=1) > 0:
            raise AlreadyExistsException()

        user.status = UserStatus.UNCONFIRMED
        user.confirmation_code = self._generate_confirmation_code()
        user.put()
        if send_email:
            self.email_service.send_user_confirmation_mail(user)
Пример #3
0
 def _get_user(self, email, filter=None):
     # filter : lambda (query -> query)
     if filter is None:
         filter = lambda f: f
     users = [user for user in filter(User.all().filter('email =', email)).run()]
     count = len(users)
     if count == 1:
         return users[0]
     elif count == 0:
         raise MissingValueException('Could not find user email=%s' % email)
     elif count > 1:
         raise MultipleValueException('Expected one user to be returned, but got multiple', users)
Пример #4
0
 def _get_user(self, email, filter=None):
     # filter : lambda (query -> query)
     if filter is None:
         filter = lambda f: f
     users = [
         user for user in filter(User.all().filter('email =', email)).run()
     ]
     count = len(users)
     if count == 1:
         return users[0]
     elif count == 0:
         raise MissingValueException('Could not find user email=%s' % email)
     elif count > 1:
         raise MultipleValueException(
             'Expected one user to be returned, but got multiple', users)