def get(self, code): try: statement = TaskAccess.get(code) if statement is None: raise ValueError except: logger.error("could not download statement for {}".format(code)) self.render("error.html") else: self.share(statement, code)
def __init__(self): handlers = [(r"/", MainHandler), (r"/list", ListHandler), (r"/info", InfoHandler), (r"/compile", TaskCompileHandler), (r"/pdf/(.*)", PDFHandler), (r"/tex/(.*)", TeXHandler), (r"/upload/(.*)", UploadHandler), (r"/mark/(.*)", MarkHandler), (r"/log/(.*)", LogHandler)] params = { "template_path": resource_filename("cms.server", "gertranslate/templates"), "static_path": resource_filename("cms.server", "gertranslate/static") } repository = Repository(config.translate_task_repository, config.translate_auto_sync) TaskAccess.init(repository, config.translate_max_compilations) TaskTranslateInfo.init(repository) self.app = Application(handlers, **params)
def get(self, code): try: gitlog = TaskAccess.getGitLog(code) if gitlog is None: raise ValueError except: logger.error( "could not download statement log for {}".format(code)) self.render("error.html") #TODO else: self.write(gitlog) self.flush()
def post(self): handle = TaskAccess.compile(self.get_argument("code")) self.write({"handle": handle})
def get(self): self.write( TaskAccess.query(self.get_argument("code"), int(self.get_argument("handle")))) self.flush()
def post(self, code): TaskAccess.mark(code)
def post(self, code): #TODO Handle Error #TODO Check file size f = self.request.files['file'][0]['body'] TaskAccess.receiveTeX(code, f)