17 lines
465 B
Python
17 lines
465 B
Python
|
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
|
|
from matemat.webserver import pagelet, RequestArguments
|
|
|
|
|
|
@pagelet('/logout')
|
|
def logout(method: str,
|
|
path: str,
|
|
args: RequestArguments,
|
|
session_vars: Dict[str, Any],
|
|
headers: Dict[str, str])\
|
|
-> Tuple[int, Optional[Union[str, bytes]]]:
|
|
if 'user' in session_vars:
|
|
del session_vars['user']
|
|
headers['Location'] = '/'
|
|
return 301, None
|