server/general: move errors to top level NS

This commit is contained in:
rr- 2016-04-02 13:13:40 +02:00
parent 06cf8c79d4
commit 769ef8f141
7 changed files with 8 additions and 9 deletions

View file

@ -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):

View file

@ -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)

View file

@ -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):
'''

View file

@ -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)

View file

@ -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 '''

View file

@ -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):