diff --git a/access.py b/access.py index 3224d18..473da32 100644 --- a/access.py +++ b/access.py @@ -1,12 +1,9 @@ +from django.conf import settings import logging from .models import Task, Project, Comment, TASKSTATE_CHOICES, TASKS_IN_WORK, PROJECTS_IN_WORK, PRIO_CHOICES -try: - from config import APP_NAME as ROOT_LOGGER_NAME -except ImportError: - ROOT_LOGGER_NAME = 'root' -logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__) +logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__) def read_attachment(request, rel_path): diff --git a/context.py b/context.py index d0fef9f..e5bca32 100644 --- a/context.py +++ b/context.py @@ -1,8 +1,10 @@ from .access import create_project_possible, create_task_possible, acc_task +from django.conf import settings from django.db.models.functions import Lower from django.utils.translation import gettext as _ from .help import actionbar as actionbar_add_help import inspect +import logging import mycreole import patt from .search import common_searches @@ -10,6 +12,8 @@ from themes import empty_entry_parameters, color_icon_url, gray_icon_url from users.context import menubar as menubar_users from users.context import PROFILE_ENTRY_UID +logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__) + ATTACHMENT_UID = 'attachment' BACK_UID = 'back' COMMENTNEW_UID = 'commentnew' @@ -28,16 +32,23 @@ def context_adaption(context, request, **kwargs): context.set_additional_title(kwargs.pop('title')) except KeyError: pass # no title in kwargs - menubar_users(context[context.MENUBAR], request) menubar(context, request, caller_name, **kwargs) actionbar(context, request, caller_name, **kwargs) - navigationbar(context, request) + navigationbar(context, request, caller_name, **kwargs) for key in kwargs: context[key] = kwargs[key] + logger.debug("context adapted: %s", repr(context)) + + +def navigationbar(context, request, caller_name, **kwargs): + bar = context[context.NAVIGATIONBAR] + add_back_menu(request, bar) + finalise_bar(request, bar) def menubar(context, request, caller_name, **kwargs): bar = context[context.MENUBAR] + menubar_users(bar, request) replace_profile(request, bar) add_help_menu(request, bar) add_tasklist_menu(request, bar) @@ -47,12 +58,6 @@ def menubar(context, request, caller_name, **kwargs): finalise_bar(request, bar) -def navigationbar(context, request): - bar = context[context.NAVIGATIONBAR] - add_back_menu(request, bar) - finalise_bar(request, bar) - - def actionbar(context, request, caller_name, **kwargs): bar = context[context.ACTIONBAR] if caller_name == 'patt_tasklist': diff --git a/search.py b/search.py index 11197c9..426d600 100644 --- a/search.py +++ b/search.py @@ -9,11 +9,7 @@ from whoosh.fields import Schema, ID, TEXT, NUMERIC, DATETIME, BOOLEAN from whoosh.qparser.dateparse import DateParserPlugin from whoosh import index, qparser -try: - from config import APP_NAME as ROOT_LOGGER_NAME -except ImportError: - ROOT_LOGGER_NAME = 'root' -logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__) +logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__) SEARCH_MY_OPEN_TASKS = 1 SEARCH_LOST_SOULS = 2