rollerverbrauch/app/filters.py

29 lines
486 B
Python

from app import app
import hashlib
import markdown
@app.template_filter('none_filter')
def none_filter(value):
if value is None:
return ''
else:
return value
@app.template_filter('md5')
def md5_filter(value):
m = hashlib.md5()
m.update(str(value).encode('UTF-8'))
return m.hexdigest()
@app.template_filter('str')
def str_filter(value):
return str(value)
@app.template_filter('markdown')
def md(value):
return markdown.markdown(value)