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

Method formatError

src/Ui/UiRequest.py:848–875  ·  view source on GitHub ↗
(self, title, message, details=True)

Source from the content-addressed store, hash-verified

846
847 @helper.encodeResponse
848 def formatError(self, title, message, details=True):
849 import sys
850 import gevent
851
852 if details and config.debug:
853 details = {key: val for key, val in list(self.env.items()) if hasattr(val, "endswith") and "COOKIE" not in key}
854 details["version_zeronet"] = "%s r%s" % (config.version, config.rev)
855 details["version_python"] = sys.version
856 details["version_gevent"] = gevent.__version__
857 details["plugins"] = PluginManager.plugin_manager.plugin_names
858 arguments = {key: val for key, val in vars(config.arguments).items() if "password" not in key}
859 details["arguments"] = arguments
860 return """
861 <style>
862 * { font-family: Consolas, Monospace; color: #333 }
863 pre { padding: 10px; background-color: #EEE }
864 </style>
865 <h1>%s</h1>
866 <h2>%s</h3>
867 <h3>Please <a href="https://github.com/HelloZeroNet/ZeroNet/issues" target="_top">report it</a> if you think this an error.</h3>
868 <h4>Details:</h4>
869 <pre>%s</pre>
870 """ % (title, html.escape(message), html.escape(json.dumps(details, indent=4, sort_keys=True)))
871 else:
872 return """
873 <h1>%s</h1>
874 <h2>%s</h3>
875 """ % (title, html.escape(message))

Callers 5

error400Method · 0.95
error403Method · 0.95
error404Method · 0.95
error500Method · 0.95
actionWrapperMethod · 0.80

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected