Skip to content

Commit fef41d1

Browse files
authored
Merge pull request #33 from dev4nsh/main
Update main.py
2 parents d789987 + 4e6320d commit fef41d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tsuki/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ async def startup():
3636

3737

3838
@app.exception_handler(status.HTTP_400_BAD_REQUEST)
39-
async def page_not_found(request: Request, exception: Exception):
39+
async def bad_request(request: Request, exception: Exception):
40+
"""Error page for 400 bad request"""
4041
return templates.TemplateResponse(
4142
"error.html",
4243
{
@@ -49,6 +50,7 @@ async def page_not_found(request: Request, exception: Exception):
4950

5051
@app.exception_handler(status.HTTP_404_NOT_FOUND)
5152
async def page_not_found(request: Request, exception: Exception):
53+
"""Error page for 404 page not found"""
5254
return templates.TemplateResponse(
5355
"error.html",
5456
{
@@ -61,6 +63,7 @@ async def page_not_found(request: Request, exception: Exception):
6163

6264
@app.exception_handler(status.HTTP_500_INTERNAL_SERVER_ERROR)
6365
async def internal_server_error(request: Request, exception: Exception):
66+
"""Error page for 500 internal server error"""
6467
return templates.TemplateResponse(
6568
"error.html",
6669
{
@@ -73,6 +76,7 @@ async def internal_server_error(request: Request, exception: Exception):
7376

7477
@app.get("/", response_class=HTMLResponse)
7578
async def root(request: Request):
79+
"""Initial home page"""
7680
return templates.TemplateResponse("index.html", {"request": request})
7781

7882

@@ -101,6 +105,7 @@ async def logout(request: Request, user: User = Depends(get_current_user)):
101105
"message": "User not logged in.",
102106
},
103107
)
108+
# Delete the authorization token from the current user session
104109
del request.session["Authorization"]
105110
return templates.TemplateResponse(
106111
"response.html", {"request": request, "message": "Logged out successfully."}

0 commit comments

Comments
 (0)