TestcaseHandler.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:mlc 作者: valiro21 项目源码 文件源码
def view_input(self):
        """
        Returns the input_file of testcase
        specified in GET request
        """

        try:
            id = int(self.get_argument('id'))
            session = self.acquire_sql_session()
            try:
                testcase = TestcaseRepository.get_by_id(session, id)
            except SQLAlchemyError:
                raise HTTPError(400, 'Testcase with specified '
                                     'id does not exist.')

        except MissingArgumentError:
            raise HTTPError(404, 'No id specified.')
        except HTTPError:
            raise
        except SQLAlchemyError:
            raise HTTPError(500, 'Database error, could not '
                                 'find specified id.')
        except:
            raise HTTPError(500, 'Unexpected error')

        # Sends the actual file data
        self.write(testcase.input_file)
        session.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号