MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / actionUiMedia

Method actionUiMedia

plugins/Sidebar/SidebarPlugin.py:33–63  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

31class UiRequestPlugin(object):
32 # Inject our resources to end of original file streams
33 def actionUiMedia(self, path):
34 if path == "/uimedia/all.js" or path == "/uimedia/all.css":
35 # First yield the original file and header
36 body_generator = super(UiRequestPlugin, self).actionUiMedia(path)
37 for part in body_generator:
38 yield part
39
40 # Append our media file to the end
41 ext = re.match(".*(js|css)$", path).group(1)
42 plugin_media_file = "%s/all.%s" % (media_dir, ext)
43 if config.debug:
44 # If debugging merge *.css to all.css and *.js to all.js
45 from Debug import DebugMedia
46 DebugMedia.merge(plugin_media_file)
47 if ext == "js":
48 yield _.translateData(open(plugin_media_file).read()).encode("utf8")
49 else:
50 for part in self.actionFile(plugin_media_file, send_header=False):
51 yield part
52 elif path.startswith("/uimedia/globe/"): # Serve WebGL globe files
53 file_name = re.match(".*/(.*)", path).group(1)
54 plugin_media_file = "%s_globe/%s" % (media_dir, file_name)
55 if config.debug and path.endswith("all.js"):
56 # If debugging merge *.css to all.css and *.js to all.js
57 from Debug import DebugMedia
58 DebugMedia.merge(plugin_media_file)
59 for part in self.actionFile(plugin_media_file):
60 yield part
61 else:
62 for part in super(UiRequestPlugin, self).actionUiMedia(path):
63 yield part
64
65 def actionZip(self):
66 address = self.get["address"]

Callers

nothing calls this directly

Calls 3

actionFileMethod · 0.95
translateDataMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected