parent
4a312378b7
commit
baeb83b1e2
@ -1,18 +1,37 @@ |
||||
class UserNotFoundError(Exception): |
||||
pass |
||||
def __init__(self): |
||||
super().__init__('user not found') |
||||
|
||||
|
||||
class GroupNotFoundError(Exception): |
||||
pass |
||||
def __init__(self): |
||||
super().__init__('group not found') |
||||
|
||||
|
||||
class BadRequest(Exception): |
||||
pass |
||||
|
||||
|
||||
class UserAlreadyExistsError(Exception): |
||||
def __init__(self): |
||||
super().__init__('user already exists') |
||||
|
||||
|
||||
class GroupAlreadyExistsError(Exception): |
||||
def __init__(self): |
||||
super().__init__('group already exists') |
||||
|
||||
|
||||
class UserAlreadySubscribedError(Exception): |
||||
pass |
||||
def __init__(self): |
||||
super().__init__('user is already subscribed') |
||||
|
||||
|
||||
class UserNotSubscribedError(Exception): |
||||
pass |
||||
def __init__(self): |
||||
super().__init__('user is not subscribed') |
||||
|
||||
|
||||
class NoSuchListError(Exception): |
||||
def __init__(self): |
||||
super().__init__('mailing list does not exist') |
||||
|
@ -0,0 +1,45 @@ |
||||
[DEFAULT] |
||||
base_domain = csclub.internal |
||||
|
||||
[ceod] |
||||
# this is the host with the ceod/admin Kerberos key |
||||
admin_host = phosphoric-acid |
||||
# this is the host with NFS no_root_squash |
||||
fs_root_host = phosphoric-acid |
||||
mailman_host = mail |
||||
use_https = false |
||||
port = 9987 |
||||
|
||||
[ldap] |
||||
admin_principal = ceod/admin |
||||
server_url = ldap://ldap-master.csclub.internal |
||||
sasl_realm = CSCLUB.INTERNAL |
||||
users_base = ou=People,dc=csclub,dc=internal |
||||
groups_base = ou=Group,dc=csclub,dc=internal |
||||
sudo_base = ou=SUDOers,dc=csclub,dc=internal |
||||
|
||||
[uwldap] |
||||
server_url = ldap://uwldap.uwaterloo.ca |
||||
base = dc=uwaterloo,dc=ca |
||||
|
||||
[members] |
||||
min_id = 20001 |
||||
max_id = 29999 |
||||
home = /users |
||||
skel = /users/skel |
||||
|
||||
[clubs] |
||||
min_id = 30001 |
||||
max_id = 39999 |
||||
home = /users |
||||
skel = /users/skel |
||||
|
||||
[mail] |
||||
smtp_url = smtp://mail.csclub.internal |
||||
smtp_starttls = false |
||||
|
||||
[mailman3] |
||||
api_base_url = http://localhost:8001/3.1 |
||||
api_username = restadmin |
||||
api_password = mailman3 |
||||
new_member_list = csc-general |
@ -0,0 +1,23 @@ |
||||
import traceback |
||||
|
||||
from flask.app import Flask |
||||
from werkzeug.exceptions import HTTPException |
||||
|
||||
from ceo_common.logger_factory import logger_factory |
||||
|
||||
__all__ = ['register_error_handlers'] |
||||
logger = logger_factory(__name__) |
||||
|
||||
|
||||
def register_error_handlers(app: Flask): |
||||
"""Register error handlers for the application.""" |
||||
app.register_error_handler(Exception, generic_error_handler) |
||||
|
||||
|
||||
def generic_error_handler(err: Exception): |
||||
"""Return JSON for internal server errors.""" |
||||
# pass through HTTP errors |
||||
if isinstance(err, HTTPException): |
||||
return err |
||||
logger.error(traceback.format_exc()) |
||||
return {'error': type(err).__name__ + ': ' + str(err)}, 500 |
Loading…
Reference in new issue