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)]
|
||||
#hits += 1
|
||||
else:
|
||||
pass
|
||||
#misses += 1
|
||||
|
||||
|
||||
|
@ -187,28 +187,27 @@ def static_image(pth):
|
||||
ext = pth.split(".")[-1]
|
||||
small_pth = pth + "-small"
|
||||
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:
|
||||
try:
|
||||
from pyvips import Image
|
||||
thumb = Image.thumbnail(data_dir['images'](pth),300)
|
||||
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:
|
||||
response = static_file(pth,root=data_dir['images']())
|
||||
resp = static_file(pth,root=data_dir['images']())
|
||||
|
||||
#response = static_file("images/" + pth,root="")
|
||||
response.set_header("Cache-Control", "public, max-age=86400")
|
||||
response.set_header("Content-Type", "image/" + ext)
|
||||
return response
|
||||
resp.set_header("Cache-Control", "public, max-age=86400")
|
||||
resp.set_header("Content-Type", "image/" + ext)
|
||||
return resp
|
||||
|
||||
|
||||
@webserver.route("/style.css")
|
||||
def get_css():
|
||||
response.content_type = 'text/css'
|
||||
global css
|
||||
if malojaconfig["DEV_MODE"]: css = generate_css()
|
||||
return css
|
||||
if malojaconfig["DEV_MODE"]: return generate_css()
|
||||
else: return css
|
||||
|
||||
|
||||
@webserver.route("/login")
|
||||
|
Loading…
Reference in New Issue
Block a user