def execute(self): result = Result() token = SoundBank().token_for_user(user=self._user) result.set_object(token) return result
def execute(self): result = Result() sounds = SoundBank().sounds_for_user(user=self._user, query=self._query) result.set_object(sounds) return result
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
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
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
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
def execute(self): SoundBank().user_listened_sound(user=self._user, sound=self._sound) return Result()
def execute(self): result = Result() result.set_object( UserFromIdCommand(user_id=self._request.session['user_id']). execute().get_object()) return result
def execute(self): result = Result() result.set_object('user_id' in self._request.session) return result
def execute(self): del self._request.session['user_id'] return Result()