Mercurial > p > roundup > code
comparison roundup/cgi/engine_jinja2.py @ 5376:64b05e24dbd8
Python 3 preparation: convert print to a function.
Tool-assisted patch. It is possible that some "from __future__ import
print_function" are not in fact needed, if a file only uses print()
with a single string as an argument and so would work fine in Python 2
without that import.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 09:54:52 +0000 |
| parents | 85484d35f1a2 |
| children | 56c9bcdea47f |
comparison
equal
deleted
inserted
replaced
| 5375:1ad46057ae4a | 5376:64b05e24dbd8 |
|---|---|
| 29 | 29 |
| 30 [ ] add {{ debug() }} dumper to inspect available variables | 30 [ ] add {{ debug() }} dumper to inspect available variables |
| 31 https://github.com/mitsuhiko/jinja2/issues/174 | 31 https://github.com/mitsuhiko/jinja2/issues/174 |
| 32 """ | 32 """ |
| 33 | 33 |
| 34 from __future__ import print_function | |
| 34 import jinja2 | 35 import jinja2 |
| 35 import gettext | 36 import gettext |
| 36 | 37 |
| 37 from types import MethodType | 38 from types import MethodType |
| 38 | 39 |
| 43 class Jinja2Loader(LoaderBase): | 44 class Jinja2Loader(LoaderBase): |
| 44 def __init__(self, dir): | 45 def __init__(self, dir): |
| 45 extensions = [ | 46 extensions = [ |
| 46 'jinja2.ext.autoescape', | 47 'jinja2.ext.autoescape', |
| 47 ] | 48 ] |
| 48 print "Jinja2 templates: ", dir | 49 print("Jinja2 templates: ", dir) |
| 49 print "Extensions: ", extensions | 50 print("Extensions: ", extensions) |
| 50 self._env = jinja2.Environment( | 51 self._env = jinja2.Environment( |
| 51 loader=jinja2.FileSystemLoader(dir), | 52 loader=jinja2.FileSystemLoader(dir), |
| 52 extensions=extensions | 53 extensions=extensions |
| 53 ) | 54 ) |
| 54 | 55 |
