def post(self): session = Session() try: switch = Switch() switch.pin = int(self.get_argument("pin")) switch.description = self.get_argument("description") session.add(switch) session.commit() except Exception as e: #log.exception(e) session.rollback() raise tornado.web.HTTPError(500)