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

Method replaceHtmlVariables

src/Ui/UiRequest.py:662–675  ·  view source on GitHub ↗
(self, block, path_parts)

Source from the content-addressed store, hash-verified

660 return template
661
662 def replaceHtmlVariables(self, block, path_parts):
663 user = self.getCurrentUser()
664 themeclass = "theme-%-6s" % re.sub("[^a-z]", "", user.settings.get("theme", "light"))
665 block = block.replace(b"{themeclass}", themeclass.encode("utf8"))
666
667 if path_parts:
668 site = self.server.sites.get(path_parts.get("address"))
669 if site.settings["own"]:
670 modified = int(time.time())
671 else:
672 modified = int(site.content_manager.contents["content.json"]["modified"])
673 block = block.replace(b"{site_modified}", str(modified).encode("utf8"))
674
675 return block
676
677 # Stream a file to client
678 def actionFile(self, file_path, block_size=64 * 1024, send_header=True, header_length=True, header_noscript=False, header_allow_ajax=False, file_size=None, file_obj=None, path_parts=None):

Callers 1

actionFileMethod · 0.95

Calls 2

getCurrentUserMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected