Refactor get_url to a lambda

This commit is contained in:
Kristóf Tóth 2018-05-03 14:11:02 +02:00
parent af6f173963
commit 3203f3af84
1 changed files with 1 additions and 5 deletions

View File

@ -10,11 +10,7 @@ BASEURL = getenv('BASEURL', '')
init_db()
app = Flask(__name__)
app.secret_key = urandom(32)
def get_url(endpoint):
return f'{BASEURL}{url_for(endpoint)}'
app.jinja_env.globals.update(get_url=get_url)
app.jinja_env.globals.update(get_url=lambda endpoint: f'{BASEURL}{url_for(endpoint)}') # pylint: disable=no-member
@app.route('/', methods=['GET', 'POST'])