def get(self, path): ''' get method ''' if not path: path = "." if path.startswith("/"): self.write("Only relative paths are allowed") self.set_status(403) self.finish() return t = Template(utils.get_asset("browse.html")) args = dict(path=path, listing=utils.get_listing(path), format_prefix=utils.format_prefix, stat=stat, get_stat=utils.get_stat, os=os, css=utils.get_asset("bootstrap.css")) self.write(t.generate(**args)) self.finish()
def get(self, path): """ get method """ t = Template(utils.get_asset("file.html")) if path is None: self.set_status(404) self.write("No such file") self.finish() return if path.startswith("/"): self.write("Only relative paths are allowed") self.set_status(403) self.finish() return args = dict( filename=path, jquery=utils.get_asset("jquery.js"), pailer=utils.get_asset("jquery.pailer.js"), css=utils.get_asset("bootstrap.css"), ) self.write(t.generate(**args)) self.finish()
async def get(self, path): """ get method """ t = Template(utils.get_asset("file.html")) if path is None: self.set_status(404) await self.finish("No such file") return if not utils.check_path(path): self.set_status(403) await self.finish("Only relative paths are allowed") return args = dict( filename=path, jquery=utils.get_asset("jquery.js"), pailer=utils.get_asset("jquery.pailer.js"), css=utils.get_asset("bootstrap.css"), ) await self.finish(t.generate(**args)) return
def get(self, path): ''' get method ''' if not path: path = "." if path.startswith("/"): self.write("Only relative paths are allowed") self.set_status(403) self.finish() return t = Template(utils.get_asset("browse.html")) args = dict( path=path, listing=utils.get_listing(path), format_prefix=utils.format_prefix, stat=stat, get_stat=utils.get_stat, os=os, css=utils.get_asset("bootstrap.css") ) self.write(t.generate(**args)) self.finish()