mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added simpler redirect directly from page script
This commit is contained in:
parent
55f0a2ceaf
commit
8cbc7a8e56
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# server stuff
|
# server stuff
|
||||||
from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template
|
from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template, HTTPResponse
|
||||||
import waitress
|
import waitress
|
||||||
# monkey patching
|
# monkey patching
|
||||||
import monkey
|
import monkey
|
||||||
@ -140,7 +140,11 @@ def static_html(name):
|
|||||||
if os.path.exists("website/" + name + ".py"):
|
if os.path.exists("website/" + name + ".py"):
|
||||||
#txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT)
|
#txt_keys = SourceFileLoader(name,"website/" + name + ".py").load_module().replacedict(keys,DATABASE_PORT)
|
||||||
try:
|
try:
|
||||||
txt_keys,resources = SourceFileLoader(name,"website/" + name + ".py").load_module().instructions(keys)
|
content = SourceFileLoader(name,"website/" + name + ".py").load_module().instructions(keys)
|
||||||
|
if isinstance(content,str): redirect(content)
|
||||||
|
txt_keys, resources = content
|
||||||
|
except HTTPResponse as e:
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log("Error in website generation: " + str(sys.exc_info()),module="error")
|
log("Error in website generation: " + str(sys.exc_info()),module="error")
|
||||||
raise
|
raise
|
||||||
|
Loading…
Reference in New Issue
Block a user