forked from mirrors/thatmattlove-hyperglass
fixed error raising issue
This commit is contained in:
parent
3bd2fc903e
commit
d86f1bf6f4
3 changed files with 11 additions and 9 deletions
|
|
@ -2,8 +2,10 @@
|
||||||
import os
|
import os
|
||||||
import math
|
import math
|
||||||
import toml
|
import toml
|
||||||
|
import hyperglass
|
||||||
|
|
||||||
dir = os.path.dirname(os.path.abspath(__file__))
|
dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
hyperglass_root = os.path.dirname(hyperglass.__file__)
|
||||||
|
|
||||||
|
|
||||||
def blacklist():
|
def blacklist():
|
||||||
|
|
@ -194,7 +196,8 @@ class gen:
|
||||||
list = []
|
list = []
|
||||||
for a in general:
|
for a in general:
|
||||||
if len(a["cache_directory"]) == 0:
|
if len(a["cache_directory"]) == 0:
|
||||||
return ".flask_cache"
|
d = ".flask_cache"
|
||||||
|
return os.path.join(hyperglass_root, d)
|
||||||
else:
|
else:
|
||||||
return a["cache_directory"]
|
return a["cache_directory"]
|
||||||
|
|
||||||
|
|
@ -310,7 +313,8 @@ class brand:
|
||||||
list = []
|
list = []
|
||||||
for t in branding:
|
for t in branding:
|
||||||
if len(t["logo_path"]) == 0:
|
if len(t["logo_path"]) == 0:
|
||||||
return "static/images/hyperglass-dark.png"
|
f = "static/images/hyperglass-dark.png"
|
||||||
|
return os.path.join(hyperglass_root, f)
|
||||||
else:
|
else:
|
||||||
return t["logo_path"]
|
return t["logo_path"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,11 +160,9 @@ def lg():
|
||||||
else:
|
else:
|
||||||
logger.info(f"Cache match for: {cache_key}, returning cached entry...")
|
logger.info(f"Cache match for: {cache_key}, returning cached entry...")
|
||||||
try:
|
try:
|
||||||
return Response(cache.get(cache_key), value_code)
|
return Response(cache.get(cache_key))
|
||||||
except:
|
except:
|
||||||
id = 4152
|
raise
|
||||||
raise RuntimeError(
|
|
||||||
id + ":\s" + "Unable to return cached output.", 415, *value_params
|
|
||||||
)
|
|
||||||
# Upon exception, render generic error
|
# Upon exception, render generic error
|
||||||
return Response(errorGeneral(id))
|
log.error(f"Error returning cached entry for: {cache_key}")
|
||||||
|
return Response(errorGeneral(4152))
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ def clearcache():
|
||||||
@main.command()
|
@main.command()
|
||||||
def testserver():
|
def testserver():
|
||||||
try:
|
try:
|
||||||
render.css.renderTemplate()
|
hyperglass.render.css.renderTemplate()
|
||||||
hyperglass.app.run(host="0.0.0.0", debug=True, port=5000)
|
hyperglass.app.run(host="0.0.0.0", debug=True, port=5000)
|
||||||
logger.error("Started test server.")
|
logger.error("Started test server.")
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue