Cleanup. Move old controller, removed unused code.
This commit is contained in:
parent
7caaea71a7
commit
bf33529bf1
|
@ -11,10 +11,10 @@ from pathlib import Path
|
|||
from logging.config import dictConfig
|
||||
from werkzeug.local import LocalProxy
|
||||
|
||||
__version__ = pkg_resources.get_distribution('flaschengeist').version
|
||||
_module_path = Path(__file__).parent
|
||||
logger = LocalProxy(lambda: logging.getLogger(__name__))
|
||||
|
||||
__version__ = pkg_resources.get_distribution('flaschengeist').version
|
||||
|
||||
with (_module_path / 'logging.yml').open(mode='rb') as file:
|
||||
config = yaml.safe_load(file.read())
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
from datetime import datetime
|
||||
|
||||
import pkg_resources
|
||||
from flask import Flask
|
||||
from flask.json import JSONEncoder, jsonify
|
||||
from flask_cors import CORS
|
||||
from datetime import datetime
|
||||
from flask.json import JSONEncoder, jsonify
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
from . import logger
|
||||
|
|
|
@ -33,7 +33,7 @@ CRYPT = SSL/STARTLS
|
|||
# Configuration of plugins #
|
||||
############################
|
||||
[geruecht]
|
||||
enable = true
|
||||
enabled = true
|
||||
|
||||
[schubu]
|
||||
enable = false
|
||||
enabled = false
|
||||
|
|
|
@ -19,34 +19,10 @@ handlers:
|
|||
class: logging.handlers.WatchedFileHandler
|
||||
level: DEBUG
|
||||
formatter: debug
|
||||
filename: geruecht/log/debug/debug.log
|
||||
encoding: utf8
|
||||
|
||||
credit:
|
||||
class: logging.handlers.WatchedFileHandler
|
||||
level: INFO
|
||||
formatter: simple
|
||||
filename: geruecht/log/info/geruecht.log
|
||||
encoding: utf8
|
||||
|
||||
jobs:
|
||||
class: logging.handlers.WatchedFileHandler
|
||||
level: INFO
|
||||
formatter: simple
|
||||
filename: geruecht/log/info/jobs.log
|
||||
filename: flaschengeist/log/debug/debug.log
|
||||
encoding: utf8
|
||||
|
||||
loggers:
|
||||
credit_logger:
|
||||
level: INFO
|
||||
handlers: [credit]
|
||||
propagate: no
|
||||
|
||||
jobs_logger:
|
||||
level: INFO
|
||||
handlers: [jobs]
|
||||
propagate: no
|
||||
|
||||
werkzeug:
|
||||
level: WARNING
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from ..mainController import Singleton
|
||||
from flaschengeist.modules.geruecht.mainController import Singleton
|
||||
from geruecht import db
|
||||
from ..databaseController import dbUserController, dbCreditListController, dbJobKindController, dbPricelistController, dbWorkerController, dbWorkgroupController, dbJobInviteController, dbJobRequesController, dbAccessTokenController, dbRegistrationController, dbFreeDrinkListConfigController
|
||||
from geruecht.exceptions import DatabaseExecption
|
|
@ -1,7 +1,7 @@
|
|||
from .. import Singleton, userController
|
||||
from ...models.user import User
|
||||
from flaschengeist.system.controller import Singleton, userController
|
||||
from flaschengeist.system.models.user import User
|
||||
from datetime import datetime, timedelta
|
||||
from ...database import db
|
||||
from flaschengeist.system.database import db
|
||||
from flask import current_app
|
||||
from werkzeug.local import LocalProxy
|
||||
logger = LocalProxy(lambda: current_app.logger)
|
|
@ -18,6 +18,7 @@ if 'FLASCHENGEIST_CONF' in os.environ:
|
|||
for loc in paths:
|
||||
try:
|
||||
with (loc/"flaschengeist.cfg").open() as source:
|
||||
logger.info("Reading config file from >{}<".format(loc))
|
||||
config.read_file(source)
|
||||
except IOError:
|
||||
pass
|
||||
|
@ -47,6 +48,8 @@ def configure_app(app):
|
|||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
if config.has_option("FLASCHENGEIST", "ROOT"):
|
||||
logger.debug("Setting application root to >{}<".format(config["FLASCHENGEIST"]["ROOT"]))
|
||||
app.config["APPLICATION_ROOT"] = config["FLASCHENGEIST"]["ROOT"]
|
||||
if config.getboolean("FLASCHENGEIST", "PROXY", fallback=False):
|
||||
logger.debug("Fixing wsgi_app for using behind a proxy server")
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from functools import wraps
|
||||
from flask import request, jsonify
|
||||
from flask import request
|
||||
from werkzeug.exceptions import Unauthorized
|
||||
|
||||
from flaschengeist import logger
|
||||
|
@ -16,7 +16,6 @@ def login_required(**kwargs):
|
|||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
token = request.headers.get('Token')
|
||||
logger.debug("token is {{ {} }}".format(token))
|
||||
access_token = ac_controller.validate_token(token, request.user_agent, roles)
|
||||
if access_token:
|
||||
kwargs['access_token'] = access_token
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
class PermissionDenied(Exception):
|
||||
def __init__(self, message=None):
|
||||
if not message:
|
||||
message = "PermissionDenied"
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class UsernameExistDB(Exception):
|
||||
pass
|
Loading…
Reference in New Issue