23 lines
384 B
Python
23 lines
384 B
Python
from app import app
|
|
import hashlib
|
|
|
|
|
|
@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)
|