Refactor
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
parent
ba71160b14
commit
eebd683ccb
1 changed files with 7 additions and 5 deletions
|
|
@ -96,12 +96,12 @@ login_manager.init_app(app)
|
||||||
commands.register_commands(app)
|
commands.register_commands(app)
|
||||||
|
|
||||||
|
|
||||||
def search_pages_path(pages_dir):
|
def search_pages_path(page_path):
|
||||||
app_path_list = [
|
app_path_list = [
|
||||||
path for path in pages_dir.glob("*_app.py") if not path.name.startswith(".")
|
path for path in page_path.glob("*_app.py") if not path.name.startswith(".")
|
||||||
]
|
]
|
||||||
api_path_list = [
|
api_path_list = [
|
||||||
path for path in pages_dir.glob("*sdk/*.py") if not path.name.startswith(".")
|
path for path in page_path.glob("*sdk/*.py") if not path.name.startswith(".")
|
||||||
]
|
]
|
||||||
app_path_list.extend(api_path_list)
|
app_path_list.extend(api_path_list)
|
||||||
return app_path_list
|
return app_path_list
|
||||||
|
|
@ -138,7 +138,7 @@ pages_dir = [
|
||||||
]
|
]
|
||||||
|
|
||||||
client_urls_prefix = [
|
client_urls_prefix = [
|
||||||
register_page(path) for dir in pages_dir for path in search_pages_path(dir)
|
register_page(path) for directory in pages_dir for path in search_pages_path(directory)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -177,5 +177,7 @@ def load_user(web_request):
|
||||||
|
|
||||||
|
|
||||||
@app.teardown_request
|
@app.teardown_request
|
||||||
def _db_close(exc):
|
def _db_close(exception):
|
||||||
|
if exception:
|
||||||
|
logging.exception(f"Request failed: {exception}")
|
||||||
close_connection()
|
close_connection()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue