Mercurial > p > roundup > code
comparison roundup/configuration.py @ 6730:031996eb9bb5
document jinja2 as valid setting for template_engine in config.ini
Also try to import jinja2 and report unavailable/available.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 27 Jun 2022 00:33:31 -0400 |
| parents | f1f2d59dab8b |
| children | 3f60a71b0812 |
comparison
equal
deleted
inserted
replaced
| 6729:14c16ba06abe | 6730:031996eb9bb5 |
|---|---|
| 868 value.decode("ascii") | 868 value.decode("ascii") |
| 869 except UnicodeError: | 869 except UnicodeError: |
| 870 value = value.decode("utf-8") | 870 value = value.decode("utf-8") |
| 871 return re.compile(value, self.flags) | 871 return re.compile(value, self.flags) |
| 872 | 872 |
| 873 try: | |
| 874 import jinja2 | |
| 875 jinja2_avail = "Available found" | |
| 876 except ImportError: | |
| 877 jinja2_avail = "Unavailable needs" | |
| 878 | |
| 873 ### Main configuration layout. | 879 ### Main configuration layout. |
| 874 # Config is described as a sequence of sections, | 880 # Config is described as a sequence of sections, |
| 875 # where each section name is followed by a sequence | 881 # where each section name is followed by a sequence |
| 876 # of Option definitions. Each Option definition | 882 # of Option definitions. Each Option definition |
| 877 # is a sequence containing class name and constructor | 883 # is a sequence containing class name and constructor |
| 884 SETTINGS = ( | 890 SETTINGS = ( |
| 885 ("main", ( | 891 ("main", ( |
| 886 (FilePathOption, "database", "db", "Database directory path."), | 892 (FilePathOption, "database", "db", "Database directory path."), |
| 887 (Option, "template_engine", "zopetal", | 893 (Option, "template_engine", "zopetal", |
| 888 "Templating engine to use.\n" | 894 "Templating engine to use.\n" |
| 889 "Possible values are 'zopetal' for the old TAL engine\n" | 895 "Possible values are:\n" |
| 890 "ported from Zope, or 'chameleon' for Chameleon."), | 896 " 'zopetal' for the old TAL engine ported from Zope,\n" |
| 897 " 'chameleon' for Chameleon,\n" | |
| 898 " 'jinja2' for jinja2 templating.\n" | |
| 899 " %s jinja2 module."%jinja2_avail), | |
| 891 (FilePathOption, "templates", "html", | 900 (FilePathOption, "templates", "html", |
| 892 "Path to the HTML templates directory."), | 901 "Path to the HTML templates directory."), |
| 893 (MultiFilePathOption, "static_files", "", | 902 (MultiFilePathOption, "static_files", "", |
| 894 "A list of space separated directory paths (or a single\n" | 903 "A list of space separated directory paths (or a single\n" |
| 895 "directory). These directories hold additional static\n" | 904 "directory). These directories hold additional static\n" |
