1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Fixed time-dependent jinja context

This commit is contained in:
Krateng 2020-09-02 14:10:47 +02:00
parent 26f6a1af58
commit ed1c595e20
2 changed files with 60 additions and 52 deletions

View File

@ -3,6 +3,7 @@ from . import filters
from .. import database, database_packed, malojatime, utilities, urihandler, malojauri from .. import database, database_packed, malojatime, utilities, urihandler, malojauri
from doreah import settings from doreah import settings
from doreah.regular import repeatdaily
import urllib import urllib
import math import math
@ -12,6 +13,16 @@ from jinja2 import Environment, PackageLoader, select_autoescape
dbp = database_packed.DB() dbp = database_packed.DB()
jinja_environment = Environment(
loader=PackageLoader('maloja', "web/jinja"),
autoescape=select_autoescape(['html', 'xml'])
)
@repeatdaily
def update_jinja_environment():
global JINJA_CONTEXT
JINJA_CONTEXT = { JINJA_CONTEXT = {
# maloja # maloja
"db": database, "db": database,
@ -61,12 +72,9 @@ JINJA_CONTEXT = {
] ]
} }
jinja_environment = Environment(
loader=PackageLoader('maloja', "web/jinja"),
autoescape=select_autoescape(['html', 'xml'])
)
jinja_environment.globals.update(JINJA_CONTEXT) jinja_environment.globals.update(JINJA_CONTEXT)
update_jinja_environment()
jinja_environment.filters.update({k:filters.__dict__[k] for k in filters.__dict__ if not k.startswith("__")}) jinja_environment.filters.update({k:filters.__dict__[k] for k in filters.__dict__ if not k.startswith("__")})
jinja_environment.trim_blocks = True jinja_environment.trim_blocks = True

View File

@ -698,7 +698,7 @@ table.tiles_top td div {
table.tiles_top td span { table.tiles_top td span {
background-color:rgba(0,0,0,0.7); background-color:rgba(0,0,0,0.7);
display: inline-block; display: table-cell;
padding: 3px; padding: 3px;
} }
table.tiles_top td a:hover { table.tiles_top td a:hover {