From ab648db336e117e551b1063093e28bfef78abf9d Mon Sep 17 00:00:00 2001
From: Krateng
+ + | +
+ + |
+
+ Pulse+ ++ + |
+
+
+ Performance+ ++ + |
+
",footerhtml + "").replace("",headerhtml + "")
+ # maloja
+ environ["db"] = database
+ environ["htmlmodules"] = htmlmodules
+ environ["malojatime"] = malojatime
+ environ["utilities"] = utilities
+ # external
+ environ["urllib"] = urllib
+ # request
+ environ["filterkeys"], environ["limitkeys"], environ["delimitkeys"], environ["amountkeys"] = uri_to_internal(keys)
+
+ #response.set_header("Content-Type","application/xhtml+xml")
+ return file("website/" + name + ".pyhp",environ)
+
+ # if not, use the old way
+ else:
+
+ with open("website/" + name + ".html") as htmlfile:
+ html = htmlfile.read()
+
+ # apply global substitutions
+ with open("website/common/footer.html") as footerfile:
+ footerhtml = footerfile.read()
+ with open("website/common/header.html") as headerfile:
+ headerhtml = headerfile.read()
+ html = html.replace("",footerhtml + "").replace("",headerhtml + "")
- # If a python file exists, it provides the replacement dict for the html file
- if os.path.exists("website/" + name + ".py"):
- #txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT)
- try:
- txt_keys,resources = SourceFileLoader(name,"website/" + name + ".py").load_module().instructions(keys)
- except Exception as e:
- log("Error in website generation: " + str(sys.exc_info()),module="error")
- raise
+ # If a python file exists, it provides the replacement dict for the html file
+ if os.path.exists("website/" + name + ".py"):
+ #txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT)
+ try:
+ txt_keys,resources = SourceFileLoader(name,"website/" + name + ".py").load_module().instructions(keys)
+ except Exception as e:
+ log("Error in website generation: " + str(sys.exc_info()),module="error")
+ raise
- # add headers for server push
- for resource in resources:
- if all(ord(c) < 128 for c in resource["file"]):
- # we can only put ascii stuff in the http header
- linkheaders.append("<" + resource["file"] + ">; rel=preload; as=" + resource["type"])
+ # add headers for server push
+ for resource in resources:
+ if all(ord(c) < 128 for c in resource["file"]):
+ # we can only put ascii stuff in the http header
+ linkheaders.append("<" + resource["file"] + ">; rel=preload; as=" + resource["type"])
- # apply key substitutions
- for k in txt_keys:
- if isinstance(txt_keys[k],list):
- # if list, we replace each occurence with the next item
- for element in txt_keys[k]:
- html = html.replace(k,element,1)
- else:
- html = html.replace(k,txt_keys[k])
+ # apply key substitutions
+ for k in txt_keys:
+ if isinstance(txt_keys[k],list):
+ # if list, we replace each occurence with the next item
+ for element in txt_keys[k]:
+ html = html.replace(k,element,1)
+ else:
+ html = html.replace(k,txt_keys[k])
- response.set_header("Link",",".join(linkheaders))
+ response.set_header("Link",",".join(linkheaders))
- return html
- #return static_file("website/" + name + ".html",root="")
+ return html
+ #return static_file("website/" + name + ".html",root="")
#set graceful shutdown
signal.signal(signal.SIGINT, graceful_exit)
diff --git a/website/artist.pyhp b/website/artist.pyhp
new file mode 100644
index 0000000..51ce1d9
--- /dev/null
+++ b/website/artist.pyhp
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+ +
+
+
+