Added an option to specify the default page when a directory is the
[cmless] / bin / cmless.py
index 825ec25..44399c9 100755 (executable)
@@ -4,7 +4,7 @@
 # See LICENSE file for copyright and license details.
 
 # Python imports
 # See LICENSE file for copyright and license details.
 
 # Python imports
-import sys
+import sys, os
 
 # CMless imports
 import config, misc, template
 
 # CMless imports
 import config, misc, template
@@ -12,6 +12,9 @@ import config, misc, template
 def main():
     print("Content-Type: text/html;charset=utf-8\n")
 
 def main():
     print("Content-Type: text/html;charset=utf-8\n")
 
+    if os.environ['REQUEST_URI'][-1] == "/":
+        os.environ['REQUEST_URI'] = os.environ['REQUEST_URI'] + config.default_page
+
     content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
     content = template.page_title(content)
     content = template.site_title(content)
     content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
     content = template.page_title(content)
     content = template.site_title(content)