def before_request(): g.debugtext = "" g.request_start_time = time.time() g.request_time = lambda: "%.5f" % (time.time() - g.request_start_time) lang = request.cookies.get('uselang') if lang is not None: msg.switch_language(lang)
def new_fn(*in_args, **in_kwargs): lang = request.args.get('uselang', None) setcookie = (lang and msg.switch_language(lang)) res = fn(*in_args, **in_kwargs) response = make_response(res) if setcookie: response.set_cookie('uselang', lang) return response
def new_fn(*in_args, **in_kwargs): lang = request.args.get("uselang", None) setcookie = lang and msg.switch_language(lang) res = fn(*in_args, **in_kwargs) response = make_response(res) if setcookie: response.set_cookie("uselang", lang) return response