Creates a template object from compiled code and the globals. This is used by the loaders and environment to create a template object.
(cls, environment, code, globals, uptodate=None)
| 946 | |
| 947 | @classmethod |
| 948 | def from_code(cls, environment, code, globals, uptodate=None): |
| 949 | """Creates a template object from compiled code and the globals. This |
| 950 | is used by the loaders and environment to create a template object. |
| 951 | """ |
| 952 | namespace = { |
| 953 | 'environment': environment, |
| 954 | '__file__': code.co_filename |
| 955 | } |
| 956 | exec(code, namespace) |
| 957 | rv = cls._from_namespace(environment, namespace, globals) |
| 958 | rv._uptodate = uptodate |
| 959 | return rv |
| 960 | |
| 961 | @classmethod |
| 962 | def from_module_dict(cls, environment, module_dict, globals): |
no test coverage detected