fix: allow template loading without the web server

See https://git.vvvvvvaria.org/decentral1se/xbotlib/issues/12
This commit is contained in:
decentral1se 2022-02-21 11:01:27 +01:00
parent f8377d8023
commit 6788e6a4f1
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 2 additions and 5 deletions

View File

@ -258,6 +258,7 @@ easily template and generate HTML. The web server is provided by
The default template search path is `index.html.j2` in the current working The default template search path is `index.html.j2` in the current working
directory. This can be configured through the usual configuration entrypoints. directory. This can be configured through the usual configuration entrypoints.
It is possible to use the template without the built-in server too!
Here's a small example that renders a random ASCII letter and uses a stylesheet. Here's a small example that renders a random ASCII letter and uses a stylesheet.

View File

@ -490,11 +490,7 @@ class Bot(ClientXMPP):
self.no_auto_join = no_auto_join self.no_auto_join = no_auto_join
self.port = port self.port = port
self.serve_web = serve_web self.serve_web = serve_web
self.template = self.load_template(template)
self.template = None
if self.serve_web:
self.template = self.load_template(template)
self.storage = storage self.storage = storage
self.output = Path(output).absolute() self.output = Path(output).absolute()