def post(self): """Saves a shout by a current user.""" if self.current_user == None: self.send_error(403) else: current_shout = Shout.objects(user=self.current_user).first() if current_shout != None: self.send_error(409) else: shout = Shout(user=self.current_user, text=xhtml_escape(self.get_argument('text'))) try: shout.save() except: logging.exception('Failed to save shout in DB.') self.send_error() else: self.write({ 'status': 'ok' })