Refactor how jinja filters are added
This commit is contained in:
parent
fda3046832
commit
2f62aebd57
@ -10,7 +10,7 @@ from flask_wtf.csrf import CSRFProtect
|
||||
|
||||
from atst.database import db
|
||||
from atst.assets import environment as assets_environment
|
||||
|
||||
from atst.filters import register_filters
|
||||
from atst.routes import bp
|
||||
from atst.routes.workspaces import bp as workspace_routes
|
||||
from atst.routes.requests import requests_bp
|
||||
@ -40,6 +40,7 @@ def make_app(config):
|
||||
|
||||
make_flask_callbacks(app)
|
||||
make_crl_validator(app)
|
||||
register_filters(app)
|
||||
|
||||
db.init_app(app)
|
||||
csrf.init_app(app)
|
||||
@ -77,11 +78,6 @@ def make_flask_callbacks(app):
|
||||
"atat_permissions": [],
|
||||
}
|
||||
|
||||
@app.template_filter('iconSvg')
|
||||
def _iconSvg(name):
|
||||
with open('static/icons/'+name+'.svg') as contents:
|
||||
return contents.read()
|
||||
|
||||
|
||||
def map_config(config):
|
||||
return {
|
||||
|
7
atst/filters.py
Normal file
7
atst/filters.py
Normal file
@ -0,0 +1,7 @@
|
||||
def iconSvg(name):
|
||||
with open('static/icons/'+name+'.svg') as contents:
|
||||
return contents.read()
|
||||
|
||||
|
||||
def register_filters(app):
|
||||
app.jinja_env.filters['iconSvg'] = iconSvg
|
Loading…
x
Reference in New Issue
Block a user