server/general: move errors to top level NS
This commit is contained in:
parent
06cf8c79d4
commit
769ef8f141
7 changed files with 8 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
''' Users public API. '''
|
||||
|
||||
import sqlalchemy
|
||||
from szurubooru.services.errors import IntegrityError, ValidationError
|
||||
from szurubooru.errors import IntegrityError, ValidationError
|
||||
from szurubooru.api.base_api import BaseApi
|
||||
|
||||
def _serialize_user(authenticated_user, user):
|
||||
|
|
|
@ -9,6 +9,7 @@ import szurubooru.config
|
|||
import szurubooru.middleware
|
||||
import szurubooru.services
|
||||
import szurubooru.util
|
||||
from szurubooru.errors import *
|
||||
|
||||
class _CustomRequest(falcon.Request):
|
||||
context_type = szurubooru.util.dotdict
|
||||
|
@ -56,9 +57,9 @@ def create_app():
|
|||
szurubooru.middleware.Authenticator(auth_service, user_service),
|
||||
])
|
||||
|
||||
app.add_error_handler(szurubooru.services.AuthError, _on_auth_error)
|
||||
app.add_error_handler(szurubooru.services.IntegrityError, _on_integrity_error)
|
||||
app.add_error_handler(szurubooru.services.ValidationError, _on_validation_error)
|
||||
app.add_error_handler(szurubooru.errors.AuthError, _on_auth_error)
|
||||
app.add_error_handler(szurubooru.errors.IntegrityError, _on_integrity_error)
|
||||
app.add_error_handler(szurubooru.errors.ValidationError, _on_validation_error)
|
||||
|
||||
app.add_route('/users/', user_list)
|
||||
app.add_route('/user/{user_name}', user)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import base64
|
||||
import falcon
|
||||
from szurubooru.model.user import User
|
||||
from szurubooru.services.errors import AuthError
|
||||
from szurubooru.errors import AuthError
|
||||
|
||||
class Authenticator(object):
|
||||
'''
|
||||
|
|
|
@ -6,5 +6,3 @@ All the business logic goes here.
|
|||
from szurubooru.services.auth_service import AuthService
|
||||
from szurubooru.services.user_service import UserService
|
||||
from szurubooru.services.password_service import PasswordService
|
||||
from szurubooru.services.errors import (
|
||||
AuthError, IntegrityError, ValidationError)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
''' Exports AuthService. '''
|
||||
|
||||
from szurubooru.services.errors import AuthError
|
||||
from szurubooru.errors import AuthError
|
||||
|
||||
class AuthService(object):
|
||||
''' Services related to user authentication '''
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import re
|
||||
from datetime import datetime
|
||||
from szurubooru.services.errors import ValidationError
|
||||
from szurubooru.errors import ValidationError
|
||||
from szurubooru.model.user import User
|
||||
|
||||
class UserService(object):
|
||||
|
|
Loading…
Reference in a new issue