Fix mistakes
This commit is contained in:
10
src/index.py
10
src/index.py
@@ -54,11 +54,6 @@ def index() -> str:
|
|||||||
def error(code) -> str:
|
def error(code) -> str:
|
||||||
''' Render a nicer error page for a given code '''
|
''' Render a nicer error page for a given code '''
|
||||||
|
|
||||||
if not code.isDigit():
|
|
||||||
code=400
|
|
||||||
elif code not in error_definitions:
|
|
||||||
return Response(code)
|
|
||||||
|
|
||||||
error_definitions = {
|
error_definitions = {
|
||||||
400: 'Bad Request',
|
400: 'Bad Request',
|
||||||
403: 'Forbidden',
|
403: 'Forbidden',
|
||||||
@@ -78,6 +73,11 @@ def error(code) -> str:
|
|||||||
505: 'Your browser tried to use a HTTP version I don\'t support. Check it is up to date.'
|
505: 'Your browser tried to use a HTTP version I don\'t support. Check it is up to date.'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not code.isdigit():
|
||||||
|
code=400
|
||||||
|
elif code not in error_definitions:
|
||||||
|
return Response(code)
|
||||||
|
|
||||||
return render_template('error.html',
|
return render_template('error.html',
|
||||||
error=f'{code}: {error_definitions.get(int(code))}',
|
error=f'{code}: {error_definitions.get(int(code))}',
|
||||||
description=error_desc.get(int(code)))
|
description=error_desc.get(int(code)))
|
||||||
|
Reference in New Issue
Block a user