mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Fixes
This commit is contained in:
parent
9f8e691924
commit
a598ba96de
@ -84,6 +84,7 @@ def cached_wrapper_individual(inner_func):
|
|||||||
result[id] = entitycache[(inner_func,id)]
|
result[id] = entitycache[(inner_func,id)]
|
||||||
#hits += 1
|
#hits += 1
|
||||||
else:
|
else:
|
||||||
|
pass
|
||||||
#misses += 1
|
#misses += 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,28 +187,27 @@ def static_image(pth):
|
|||||||
ext = pth.split(".")[-1]
|
ext = pth.split(".")[-1]
|
||||||
small_pth = pth + "-small"
|
small_pth = pth + "-small"
|
||||||
if os.path.exists(data_dir['images'](small_pth)):
|
if os.path.exists(data_dir['images'](small_pth)):
|
||||||
response = static_file(small_pth,root=data_dir['images']())
|
resp = static_file(small_pth,root=data_dir['images']())
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
from pyvips import Image
|
from pyvips import Image
|
||||||
thumb = Image.thumbnail(data_dir['images'](pth),300)
|
thumb = Image.thumbnail(data_dir['images'](pth),300)
|
||||||
thumb.webpsave(data_dir['images'](small_pth))
|
thumb.webpsave(data_dir['images'](small_pth))
|
||||||
response = static_file(small_pth,root=data_dir['images']())
|
resp = static_file(small_pth,root=data_dir['images']())
|
||||||
except Exception:
|
except Exception:
|
||||||
response = static_file(pth,root=data_dir['images']())
|
resp = static_file(pth,root=data_dir['images']())
|
||||||
|
|
||||||
#response = static_file("images/" + pth,root="")
|
#response = static_file("images/" + pth,root="")
|
||||||
response.set_header("Cache-Control", "public, max-age=86400")
|
resp.set_header("Cache-Control", "public, max-age=86400")
|
||||||
response.set_header("Content-Type", "image/" + ext)
|
resp.set_header("Content-Type", "image/" + ext)
|
||||||
return response
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@webserver.route("/style.css")
|
@webserver.route("/style.css")
|
||||||
def get_css():
|
def get_css():
|
||||||
response.content_type = 'text/css'
|
response.content_type = 'text/css'
|
||||||
global css
|
if malojaconfig["DEV_MODE"]: return generate_css()
|
||||||
if malojaconfig["DEV_MODE"]: css = generate_css()
|
else: return css
|
||||||
return css
|
|
||||||
|
|
||||||
|
|
||||||
@webserver.route("/login")
|
@webserver.route("/login")
|
||||||
|
Loading…
Reference in New Issue
Block a user