From a5c7f56abd77418ce5cd146080a376221670a204 Mon Sep 17 00:00:00 2001 From: Erickson Silva Date: Tue, 4 Oct 2016 21:34:03 -0300 Subject: [PATCH] [TranslationServer] Corrige rota para regionalismo --- src/TranslationServer.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/TranslationServer.py b/src/TranslationServer.py index 8261528..de70cd4 100644 --- a/src/TranslationServer.py +++ b/src/TranslationServer.py @@ -256,22 +256,28 @@ def update_list_bundles(): @app.route("//", methods=['GET']) @check_run_mode -def get_sign(platform, sign, state=None): +def get_sign(platform, sign): platform = platform.encode("UTF-8") sign = sign.encode("UTF-8") if " " in sign or platform not in BUNDLES_PATH: abort(400) - file_exists = sign in BUNDLES_LIST["DEFAULT"] if state == None else sign in BUNDLES_LIST[state] + file_exists = sign in BUNDLES_LIST["DEFAULT"] thread.start_new_thread(update_database_statistic, (sign, platform, file_exists)) - if file_exists and state is not None: - return send_from_directory(os.path.join(BUNDLES_PATH[platform], state), sign) - elif file_exists or (sign in BUNDLES_LIST["DEFAULT"] and state is not None): + if file_exists: return send_from_directory(BUNDLES_PATH[platform], sign) abort(404) @app.route("///", methods=['GET']) @check_run_mode -def get_sign_localism(platform, state, sign): - return get_sign(platform, sign, state) +def get_sign_state(platform, state, sign): + platform = platform.encode("UTF-8") + sign = sign.encode("UTF-8") + state = state.encode("UTF-8") + if " " in sign or platform not in BUNDLES_PATH: abort(400) + file_exists = sign in BUNDLES_LIST[state] + thread.start_new_thread(update_database_statistic, (sign, platform, file_exists)) + if file_exists: + return send_from_directory(os.path.join(BUNDLES_PATH[platform], state), sign) + return get_sign(platform.decode("UTF-8"), sign.decode("UTF-8")) if __name__ == "__main__": parser = argparse.ArgumentParser(description='Translation server and signs download for VLibras.') -- libgit2 0.21.2