Esempio n. 1
0
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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()
Esempio n. 4
0
 def post(self):
     handle = TaskAccess.compile(self.get_argument("code"))
     self.write({"handle": handle})
Esempio n. 5
0
 def get(self):
     self.write(
         TaskAccess.query(self.get_argument("code"),
                          int(self.get_argument("handle"))))
     self.flush()
Esempio n. 6
0
 def post(self, code):
     TaskAccess.mark(code)
Esempio n. 7
0
 def post(self, code):
     #TODO Handle Error
     #TODO Check file size
     f = self.request.files['file'][0]['body']
     TaskAccess.receiveTeX(code, f)