Load a template from the loader. If a loader is configured this method asks the loader for the template and returns a :class:`Template`. If the `parent` parameter is not `None`, :meth:`join_path` is called to get the real template name before loading. The `globals`
(self, name, parent=None, globals=None)
| 808 | |
| 809 | @internalcode |
| 810 | def get_template(self, name, parent=None, globals=None): |
| 811 | """Load a template from the loader. If a loader is configured this |
| 812 | method asks the loader for the template and returns a :class:`Template`. |
| 813 | If the `parent` parameter is not `None`, :meth:`join_path` is called |
| 814 | to get the real template name before loading. |
| 815 | |
| 816 | The `globals` parameter can be used to provide template wide globals. |
| 817 | These variables are available in the context at render time. |
| 818 | |
| 819 | If the template does not exist a :exc:`TemplateNotFound` exception is |
| 820 | raised. |
| 821 | |
| 822 | .. versionchanged:: 2.4 |
| 823 | If `name` is a :class:`Template` object it is returned from the |
| 824 | function unchanged. |
| 825 | """ |
| 826 | if isinstance(name, Template): |
| 827 | return name |
| 828 | if parent is not None: |
| 829 | name = self.join_path(name, parent) |
| 830 | return self._load_template(name, self.make_globals(globals)) |
| 831 | |
| 832 | @internalcode |
| 833 | def select_template(self, names, parent=None, globals=None): |
no test coverage detected