Ejemplo n.º 1
0
    def execute(self):
        result = Result()

        try:
            sound = SoundBank().sound_from_id(sound_id=self._sound_id)
            result.set_object(sound)
        except SoundNotFoundException:
            result.add_error("Sound not found")

        return result
Ejemplo n.º 2
0
    def execute(self):
        result = Result()

        try:
            user = SoundBank().user_from_id(user_id=self._user_id)
            result.set_object(user)
        except UserNotFoundException:
            result.add_error("User not found")

        return result
Ejemplo n.º 3
0
    def execute(self):
        result = Result()

        try:
            user, token_has_expired = SoundBank().user_from_token(
                token=self._token)
            if token_has_expired:
                result.add_error("Token has expired")
            else:
                two_hours = 60 * 60 * 2
                self._request.session.set_expiry(two_hours)
                self._request.session['user_id'] = user.user_id()
                result.set_object(user)
        except UserNotFoundException:
            result.add_error("User not found")

        return result