Rename config_templates to templates
Committed bf44f7
--- a/web/framework/__init__.py
+++ b/web/framework/__init__.py
"nbencode",
"nbdecode",
"nbrandom",
- "config_templates",
+ "templates",
"generate_cert",
"now",
"dump",
"data": "TEXT NOT NULL",
},
)
-config_templates = templating.templates(__name__)
+templates = templating.templates(__name__)
methods = [
"head",
"get",
(root / "etc").mkdir()
with (root / "etc/redis.conf").open("w") as fp:
- fp.write(str(config_templates.redis(root)))
+ fp.write(str(templates.redis(root)))
with (root / "etc/supervisor.conf").open("w") as fp:
fp.write(
- str(
- config_templates.supervisor(
- root, root_hash, getpass.getuser(), env, app, bot
- )
- )
+ str(templates.supervisor(root, root_hash, getpass.getuser(), env, app, bot))
)
with (root / "etc/nginx.conf").open("w") as fp:
- fp.write(str(config_templates.nginx(root_hash)))
+ fp.write(str(templates.nginx(root_hash)))
(root / "run").mkdir(parents=True)
with (root / "etc/tor_stem_password").open("w") as fp:
# **self.path_args)
# XXX except AttributeError:
# XXX path_args = self.path_args
- templates = {
+ arg_templates = {
k: "(?P<{}>{})".format(k, v) for k, v in self.path_args.items()
}
try:
- path = path_template.format(**templates)
+ path = path_template.format(**arg_templates)
except KeyError as err:
raise KeyError(
"undefined URI fragment" " type `{}`".format(err.args[0])
# TODO metaclass for `__repr__` -- see `app.controllers`
class Route(controller, Resource):
__doc__ = controller.__doc__
- __web__ = path_template, templates, self
+ __web__ = path_template, arg_templates, self
handler = controller
Route.prefixed = prefixed
tx.response.status = "500 Internal Server Error"
tx.response.headers.content_type = "text/html"
if getattr(tx.user, "is_owner", False):
- body = config_templates.traceback(*sys.exc_info())
+ body = templates.traceback(*sys.exc_info())
else:
body = "<small><code>I have been notified.</code></small>"
- # body = config_templates.traceback(*sys.exc_info())
+ # body = templates.traceback(*sys.exc_info())
# TODO body = self.view.error.internal()
tx.response.body = body