Commits

Arne Babenhauserheide  committed 9c10708

FIX: now works without precreated wiki repository.

  • Participants
  • Parent commits 2d4fdb6

Comments (0)

Files changed (1)

File wikiserver.py

 	    # strip the edit url segment, then call edit_file
 	    self.wfile.write(edit_file(self.path[len(EDIT_URL_SEGMENT):]))
         elif self.path == "/":
-            self.wfile.write(serve_html("/index.html"))
+            self.wfile.write(serve_html("index.txt"))
         elif isdir(join(BASE_PATH, "static", self.path[1:])):
             print "blia", self.path
             self.wfile.write(serve_html(join(self.path, "index.html")))
 
 
 def main():
+    try: 
+        if not exists(BASE_PATH):
+            makedirs(BASE_PATH)
+            call(["hg", "init", BASE_PATH])
+        segments={"text": ("", ), "commit_message": ["initial commit"]}
+        save_file(join(BASE_PATH, "static", "index.html"), segments)
+    except IOError, e: 
+        print "could not create the needed wiki directory:", e
     try:
         server = HTTPServer(('', 8081), HTTPHtmlHandler)
         print 'started httpserver...'