MCPcopy Create free account
hub / github.com/EasyIME/PIME / get_template_namespace

Method get_template_namespace

python/python3/tornado/web.py:1016–1037  ·  view source on GitHub ↗

Returns a dictionary to be used as the default template namespace. May be overridden by subclasses to add or modify values. The results of this method will be combined with additional defaults in the `tornado.template` module and keyword arguments to `render` or `re

(self)

Source from the content-addressed store, hash-verified

1014 return t.generate(**namespace)
1015
1016 def get_template_namespace(self) -> Dict[str, Any]:
1017 """Returns a dictionary to be used as the default template namespace.
1018
1019 May be overridden by subclasses to add or modify values.
1020
1021 The results of this method will be combined with additional
1022 defaults in the `tornado.template` module and keyword arguments
1023 to `render` or `render_string`.
1024 """
1025 namespace = dict(
1026 handler=self,
1027 request=self.request,
1028 current_user=self.current_user,
1029 locale=self.locale,
1030 _=self.locale.translate,
1031 pgettext=self.locale.pgettext,
1032 static_url=self.static_url,
1033 xsrf_form_html=self.xsrf_form_html,
1034 reverse_url=self.reverse_url,
1035 )
1036 namespace.update(self.ui)
1037 return namespace
1038
1039 def create_template_loader(self, template_path: str) -> template.BaseLoader:
1040 """Returns a new template loader for the given path.

Callers 1

render_stringMethod · 0.95

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected