Fix non-working code
This commit is contained in:
parent
227c042642
commit
dfa7138091
@ -29,7 +29,8 @@ def render_page(page):
|
|||||||
path = f'{PANDOC_PATH}/{page}'
|
path = f'{PANDOC_PATH}/{page}'
|
||||||
whitelist = WHITELIST_PATH
|
whitelist = WHITELIST_PATH
|
||||||
with open(whitelist, 'r') as f:
|
with open(whitelist, 'r') as f:
|
||||||
if page not in f.readlines():
|
lines = f.read().splitlines()
|
||||||
|
if page not in lines:
|
||||||
raise Exception("Page doesn't exist!")
|
raise Exception("Page doesn't exist!")
|
||||||
if not os.path.exists(f'{path}'):
|
if not os.path.exists(f'{path}'):
|
||||||
raise Exception("Page doesn't exist!")
|
raise Exception("Page doesn't exist!")
|
||||||
@ -45,7 +46,9 @@ def get_pandoc_page(page):
|
|||||||
path = f'{PANDOC_PATH}/{page}'
|
path = f'{PANDOC_PATH}/{page}'
|
||||||
whitelist = WHITELIST_PATH
|
whitelist = WHITELIST_PATH
|
||||||
with open(whitelist, 'r') as f:
|
with open(whitelist, 'r') as f:
|
||||||
if page not in f.readlines():
|
lines = f.read().splitlines()
|
||||||
|
if page not in lines:
|
||||||
|
print('Access to page not in list {page}')
|
||||||
return 'This page does not exist'
|
return 'This page does not exist'
|
||||||
if not os.path.exists(f'{path}'):
|
if not os.path.exists(f'{path}'):
|
||||||
# TODO: Add 404 handler
|
# TODO: Add 404 handler
|
||||||
|
Reference in New Issue
Block a user