def send_user_courses(self, message): """Send current user's courses to the client. This method is subscribed to the ``courses.user.get`` message type. :param dict message: The client's message that executed this method. """ try: courses = yield Course.get_user_courses(self.handler.user) self.pub_subs['w'].send_message({ 'type': 'courses', 'courses': courses }) except AttributeError: if not hasattr(self.handler, 'user'): self.handler.send_user_not_loaded_error(message) else: raise
def send_user_courses(self, message): """Send current user's courses to the client. This method is subscribed to the ``courses.user.get`` message type. :param dict message: The client's message that executed this method. """ try: courses = yield Course.get_user_courses( self.handler.user) self.pub_subs['w'].send_message( {'type': 'courses', 'courses': courses}) except AttributeError: if not hasattr(self.handler, 'user'): self.handler.send_user_not_loaded_error( message) else: raise