Handle unexistence of page
This commit is contained in:
parent
85073b161e
commit
1eba074b6a
@ -24,8 +24,6 @@ def get_all_names():
|
|||||||
|
|
||||||
|
|
||||||
def get_page(name: str) -> WikiPage:
|
def get_page(name: str) -> WikiPage:
|
||||||
if name not in get_all_names():
|
|
||||||
raise Exception("Page doesn't exist!")
|
|
||||||
path = f'{PANDOC_PATH}/{name}'
|
path = f'{PANDOC_PATH}/{name}'
|
||||||
with open(f'{path}/config.json', 'r') as f:
|
with open(f'{path}/config.json', 'r') as f:
|
||||||
page = WikiPage.parse_raw(f.read())
|
page = WikiPage.parse_raw(f.read())
|
||||||
@ -47,6 +45,8 @@ def dated_url_for(endpoint, **values):
|
|||||||
|
|
||||||
@app.route(f'/{PANDOC_LINK}/<name>')
|
@app.route(f'/{PANDOC_LINK}/<name>')
|
||||||
def get_pandoc_page(name: str):
|
def get_pandoc_page(name: str):
|
||||||
|
if name not in get_all_names():
|
||||||
|
return "Page doesn't exist"
|
||||||
page = get_page(name)
|
page = get_page(name)
|
||||||
template = page.template
|
template = page.template
|
||||||
with open(page.get_file('render.html'), 'r') as f:
|
with open(page.get_file('render.html'), 'r') as f:
|
||||||
|
Reference in New Issue
Block a user