diff --git a/flaschengeist/__init__.py b/flaschengeist/__init__.py index 7882802..958aa0f 100644 --- a/flaschengeist/__init__.py +++ b/flaschengeist/__init__.py @@ -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()) diff --git a/flaschengeist/app.py b/flaschengeist/app.py index a4103ae..266fa3d 100644 --- a/flaschengeist/app.py +++ b/flaschengeist/app.py @@ -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 diff --git a/flaschengeist/flaschengeist.example.cfg b/flaschengeist/flaschengeist.example.cfg index 1312331..f9db244 100644 --- a/flaschengeist/flaschengeist.example.cfg +++ b/flaschengeist/flaschengeist.example.cfg @@ -33,7 +33,7 @@ CRYPT = SSL/STARTLS # Configuration of plugins # ############################ [geruecht] -enable = true +enabled = true [schubu] -enable = false +enabled = false diff --git a/flaschengeist/logging.yml b/flaschengeist/logging.yml index 715b92d..96b71e8 100644 --- a/flaschengeist/logging.yml +++ b/flaschengeist/logging.yml @@ -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 diff --git a/flaschengeist/system/controller/databaseController/__init__.py b/flaschengeist/modules/geruecht/databaseController/__init__.py similarity index 97% rename from flaschengeist/system/controller/databaseController/__init__.py rename to flaschengeist/modules/geruecht/databaseController/__init__.py index e53e75b..de5ff2d 100644 --- a/flaschengeist/system/controller/databaseController/__init__.py +++ b/flaschengeist/modules/geruecht/databaseController/__init__.py @@ -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 diff --git a/flaschengeist/system/controller/databaseController/dbAccessTokenController.py b/flaschengeist/modules/geruecht/databaseController/dbAccessTokenController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbAccessTokenController.py rename to flaschengeist/modules/geruecht/databaseController/dbAccessTokenController.py diff --git a/flaschengeist/system/controller/databaseController/dbCreditListController.py b/flaschengeist/modules/geruecht/databaseController/dbCreditListController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbCreditListController.py rename to flaschengeist/modules/geruecht/databaseController/dbCreditListController.py diff --git a/flaschengeist/system/controller/databaseController/dbFreeDrinkListConfigController.py b/flaschengeist/modules/geruecht/databaseController/dbFreeDrinkListConfigController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbFreeDrinkListConfigController.py rename to flaschengeist/modules/geruecht/databaseController/dbFreeDrinkListConfigController.py diff --git a/flaschengeist/system/controller/databaseController/dbJobInviteController.py b/flaschengeist/modules/geruecht/databaseController/dbJobInviteController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbJobInviteController.py rename to flaschengeist/modules/geruecht/databaseController/dbJobInviteController.py diff --git a/flaschengeist/system/controller/databaseController/dbJobKindController.py b/flaschengeist/modules/geruecht/databaseController/dbJobKindController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbJobKindController.py rename to flaschengeist/modules/geruecht/databaseController/dbJobKindController.py diff --git a/flaschengeist/system/controller/databaseController/dbJobRequesController.py b/flaschengeist/modules/geruecht/databaseController/dbJobRequesController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbJobRequesController.py rename to flaschengeist/modules/geruecht/databaseController/dbJobRequesController.py diff --git a/flaschengeist/system/controller/databaseController/dbPricelistController.py b/flaschengeist/modules/geruecht/databaseController/dbPricelistController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbPricelistController.py rename to flaschengeist/modules/geruecht/databaseController/dbPricelistController.py diff --git a/flaschengeist/system/controller/databaseController/dbRegistrationController.py b/flaschengeist/modules/geruecht/databaseController/dbRegistrationController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbRegistrationController.py rename to flaschengeist/modules/geruecht/databaseController/dbRegistrationController.py diff --git a/flaschengeist/system/controller/databaseController/dbUserController.py b/flaschengeist/modules/geruecht/databaseController/dbUserController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbUserController.py rename to flaschengeist/modules/geruecht/databaseController/dbUserController.py diff --git a/flaschengeist/system/controller/databaseController/dbWorkerController.py b/flaschengeist/modules/geruecht/databaseController/dbWorkerController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbWorkerController.py rename to flaschengeist/modules/geruecht/databaseController/dbWorkerController.py diff --git a/flaschengeist/system/controller/databaseController/dbWorkgroupController.py b/flaschengeist/modules/geruecht/databaseController/dbWorkgroupController.py similarity index 100% rename from flaschengeist/system/controller/databaseController/dbWorkgroupController.py rename to flaschengeist/modules/geruecht/databaseController/dbWorkgroupController.py diff --git a/flaschengeist/system/controller/mainController/__init__.py b/flaschengeist/modules/geruecht/mainController/__init__.py similarity index 97% rename from flaschengeist/system/controller/mainController/__init__.py rename to flaschengeist/modules/geruecht/mainController/__init__.py index 72c0076..61ce1b5 100644 --- a/flaschengeist/system/controller/mainController/__init__.py +++ b/flaschengeist/modules/geruecht/mainController/__init__.py @@ -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) diff --git a/flaschengeist/system/controller/mainController/mainCreditListController.py b/flaschengeist/modules/geruecht/mainController/mainCreditListController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainCreditListController.py rename to flaschengeist/modules/geruecht/mainController/mainCreditListController.py diff --git a/flaschengeist/system/controller/mainController/mainFreeDrinkListConfigController.py b/flaschengeist/modules/geruecht/mainController/mainFreeDrinkListConfigController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainFreeDrinkListConfigController.py rename to flaschengeist/modules/geruecht/mainController/mainFreeDrinkListConfigController.py diff --git a/flaschengeist/system/controller/mainController/mainJobInviteController.py b/flaschengeist/modules/geruecht/mainController/mainJobInviteController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainJobInviteController.py rename to flaschengeist/modules/geruecht/mainController/mainJobInviteController.py diff --git a/flaschengeist/system/controller/mainController/mainJobKindController.py b/flaschengeist/modules/geruecht/mainController/mainJobKindController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainJobKindController.py rename to flaschengeist/modules/geruecht/mainController/mainJobKindController.py diff --git a/flaschengeist/system/controller/mainController/mainJobRequestController.py b/flaschengeist/modules/geruecht/mainController/mainJobRequestController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainJobRequestController.py rename to flaschengeist/modules/geruecht/mainController/mainJobRequestController.py diff --git a/flaschengeist/system/controller/mainController/mainPasswordReset.py b/flaschengeist/modules/geruecht/mainController/mainPasswordReset.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainPasswordReset.py rename to flaschengeist/modules/geruecht/mainController/mainPasswordReset.py diff --git a/flaschengeist/system/controller/mainController/mainPricelistController.py b/flaschengeist/modules/geruecht/mainController/mainPricelistController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainPricelistController.py rename to flaschengeist/modules/geruecht/mainController/mainPricelistController.py diff --git a/flaschengeist/system/controller/mainController/mainRegistrationController.py b/flaschengeist/modules/geruecht/mainController/mainRegistrationController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainRegistrationController.py rename to flaschengeist/modules/geruecht/mainController/mainRegistrationController.py diff --git a/flaschengeist/system/controller/mainController/mainWorkerController.py b/flaschengeist/modules/geruecht/mainController/mainWorkerController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainWorkerController.py rename to flaschengeist/modules/geruecht/mainController/mainWorkerController.py diff --git a/flaschengeist/system/controller/mainController/mainWorkgroupController.py b/flaschengeist/modules/geruecht/mainController/mainWorkgroupController.py similarity index 100% rename from flaschengeist/system/controller/mainController/mainWorkgroupController.py rename to flaschengeist/modules/geruecht/mainController/mainWorkgroupController.py diff --git a/flaschengeist/system/config.py b/flaschengeist/system/config.py index 658e051..e8181a2 100644 --- a/flaschengeist/system/config.py +++ b/flaschengeist/system/config.py @@ -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) diff --git a/flaschengeist/system/decorator.py b/flaschengeist/system/decorator.py index 930cf17..de3b2df 100644 --- a/flaschengeist/system/decorator.py +++ b/flaschengeist/system/decorator.py @@ -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 diff --git a/flaschengeist/system/exceptions/__init__.py b/flaschengeist/system/exceptions/__init__.py deleted file mode 100644 index 0972d22..0000000 --- a/flaschengeist/system/exceptions/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -class PermissionDenied(Exception): - def __init__(self, message=None): - if not message: - message = "PermissionDenied" - super().__init__(message) - - -class UsernameExistDB(Exception): - pass