minor fixes

This commit is contained in:
Izalia Mae 2020-03-07 15:19:35 -05:00
parent 48a57863d7
commit 623bcd6a32
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,9 @@
'''functions to alter colors in hex format'''
import re
from colour import Color
check = lambda color: Color(f'#{str(color)}' if re.search(r'^(?:[0-9a-fA-F]{3}){1,2}$', color) else color)
def _multi(multiplier):

View file

@ -4,7 +4,7 @@ import codecs, traceback, os, json, aiohttp
from os import listdir, makedirs
from os.path import isfile, isdir, getmtime, abspath
from jinja2 import Environment, FileSystemLoader, ChoiceLoader
from jinja2 import Environment, FileSystemLoader, ChoiceLoader, select_autoescape
from hamlpy.hamlpy import Compiler
from markdown import markdown
@ -100,7 +100,10 @@ def delEnv(var):
def setup():
global env
env = Environment(
loader=ChoiceLoader([FileSystemLoader(path) for path in search_path])
loader=ChoiceLoader([FileSystemLoader(path) for path in search_path]),
autoescape=select_autoescape(['html', 'css']),
lstrip_blocks=True,
trim_blocks=True
)
@ -116,7 +119,7 @@ def renderTemplate(tplfile, context, request=None, headers=dict(), cookies=dict(
def aiohttpTemplate(*args, **kwargs):
ctype = kwargs.get('contentType', 'text/html')
ctype = kwargs.get('content_type', 'text/html')
status = kwargs.get('status', 200)
html = renderTemplate(*args, **kwargs)
return aiohttp.web.Response(body=html, status=status, content_type=ctype)