Added URL 'un'parsing to change things like "%20" to spaces for use with
[cmless] / bin / cmless.py
... / ...
CommitLineData
1#!/usr/bin/python3
2
3# (c) 2017 Aaron Taylor <ataylor at subgeniuskitty dot com>
4# See LICENSE file for copyright and license details.
5
6# Python imports
7import sys, os, urllib.parse
8
9# CMless imports
10import config, misc, template
11
12def main():
13 print("Content-Type: text/html;charset=utf-8\n")
14
15 if os.environ['REQUEST_URI'][-1] == "/":
16 os.environ['REQUEST_URI'] = os.environ['REQUEST_URI'] + config.default_page
17 os.environ['REQUEST_URI'] = urllib.parse.unquote(os.environ['REQUEST_URI'])
18
19 content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
20 content = template.page_title(content)
21 content = template.site_title(content)
22 content = template.current_year(content)
23 content = template.head_meta_description(content)
24 content = template.head_meta_keywords(content)
25 content = template.body(content)
26 print(content)
27
28if __name__ == "__main__":
29 sys.exit(main())