Ejemplo n.º 1
0
 def GET(self, name=""):
     bufsize = 1024 * 100
     dirname = os.path.join(xconfig.SCRIPTS_DIR, name)
     outpath = os.path.join(xconfig.TMP_DIR, name + ".zip")
     ziputil.zip_dir(dirname, outpath=outpath)
     web.header("Content-Disposition", "attachment; filename=%s.zip" % name)
     with open(outpath, "rb") as fp:
         buf = fp.read(bufsize)
         while buf:
             yield buf
             buf = fp.read(bufsize)
Ejemplo n.º 2
0
 def GET(self):
     bufsize = 1024 * 100
     dirname = xconfig.SCRIPTS_DIR
     outpath = os.path.join(dirname, "fs-plugins.zip")
     ziputil.zip_dir(dirname,
                     outpath=outpath,
                     filter=lambda x: os.path.basename(x).startswith("fs-")
                     and x.endswith(".py"))
     web.header("Content-Disposition",
                "attachment; filename=fs-plugins.zip")
     with open(outpath, "rb") as fp:
         buf = fp.read(bufsize)
         while buf:
             yield buf
             buf = fp.read(bufsize)