MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / actionZip

Method actionZip

plugins/Sidebar/SidebarPlugin.py:65–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63 yield part
64
65 def actionZip(self):
66 address = self.get["address"]
67 site = self.server.site_manager.get(address)
68 if not site:
69 return self.error404("Site not found")
70
71 title = site.content_manager.contents.get("content.json", {}).get("title", "")
72 filename = "%s-backup-%s.zip" % (title, time.strftime("%Y-%m-%d_%H_%M"))
73 filename_quoted = urllib.parse.quote(filename)
74 self.sendHeader(content_type="application/zip", extra_headers={'Content-Disposition': 'attachment; filename="%s"' % filename_quoted})
75
76 return self.streamZip(site.storage.getPath("."))
77
78 def streamZip(self, dir_path):
79 zs = ZipStream(dir_path)

Callers

nothing calls this directly

Calls 5

streamZipMethod · 0.95
error404Method · 0.80
sendHeaderMethod · 0.80
getPathMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected