예제 #1
0
 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()
예제 #2
0
 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()
예제 #3
0
    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
예제 #4
0
 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()
예제 #5
0
 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()