minor fixes
This commit is contained in:
parent
48a57863d7
commit
623bcd6a32
|
@ -1,6 +1,9 @@
|
||||||
'''functions to alter colors in hex format'''
|
'''functions to alter colors in hex format'''
|
||||||
|
import re
|
||||||
|
|
||||||
from colour import Color
|
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)
|
check = lambda color: Color(f'#{str(color)}' if re.search(r'^(?:[0-9a-fA-F]{3}){1,2}$', color) else color)
|
||||||
|
|
||||||
def _multi(multiplier):
|
def _multi(multiplier):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import codecs, traceback, os, json, aiohttp
|
||||||
from os import listdir, makedirs
|
from os import listdir, makedirs
|
||||||
from os.path import isfile, isdir, getmtime, abspath
|
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 hamlpy.hamlpy import Compiler
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
|
|
||||||
|
@ -100,7 +100,10 @@ def delEnv(var):
|
||||||
def setup():
|
def setup():
|
||||||
global env
|
global env
|
||||||
env = Environment(
|
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):
|
def aiohttpTemplate(*args, **kwargs):
|
||||||
ctype = kwargs.get('contentType', 'text/html')
|
ctype = kwargs.get('content_type', 'text/html')
|
||||||
status = kwargs.get('status', 200)
|
status = kwargs.get('status', 200)
|
||||||
html = renderTemplate(*args, **kwargs)
|
html = renderTemplate(*args, **kwargs)
|
||||||
return aiohttp.web.Response(body=html, status=status, content_type=ctype)
|
return aiohttp.web.Response(body=html, status=status, content_type=ctype)
|
||||||
|
|
Loading…
Reference in a new issue