예제 #1
0
    def execute(self):
        result = Result()

        token = SoundBank().token_for_user(user=self._user)
        result.set_object(token)

        return result
예제 #2
0
    def execute(self):
        result = Result()

        sounds = SoundBank().sounds_for_user(user=self._user,
                                             query=self._query)
        result.set_object(sounds)

        return result
예제 #3
0
 def execute(self):
     result = Result()
     user = SoundBank().get_create_or_update_user(
         user_id=self._user_id,
         username=self._username,
         first_name=self._first_name,
         last_name=self._last_name)
     result.set_object(user)
     return result
예제 #4
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
예제 #5
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
예제 #6
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
예제 #7
0
 def execute(self):
     result = Result()
     result.set_object(
         UserFromIdCommand(user_id=self._request.session['user_id']).
         execute().get_object())
     return result
예제 #8
0
 def execute(self):
     result = Result()
     result.set_object('user_id' in self._request.session)
     return result