rollerverbrauch/app/filters.py

23 lines
384 B
Python
Raw Normal View History

2016-07-03 19:29:30 +02:00
from app import app
2016-05-02 06:42:43 +02:00
import hashlib
2016-04-27 07:23:28 +02:00
@app.template_filter('none_filter')
def none_filter(value):
if value is None:
return ''
else:
return value
2016-05-02 06:42:43 +02:00
@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)