2016-07-03 19:29:30 +02:00
|
|
|
from app import app
|
2016-05-02 06:42:43 +02:00
|
|
|
import hashlib
|
2016-11-06 13:14:03 +01:00
|
|
|
import markdown
|
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)
|
2016-11-06 13:14:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
@app.template_filter('markdown')
|
|
|
|
def md(value):
|
|
|
|
return markdown.markdown(value)
|