Browse Source

Changes due to django_lib update

master
Dirk Alders 3 weeks ago
parent
commit
577956248e
3 changed files with 16 additions and 18 deletions
  1. 2
    5
      access.py
  2. 13
    8
      context.py
  3. 1
    5
      search.py

+ 2
- 5
access.py View File

1
+from django.conf import settings
1
 import logging
2
 import logging
2
 from .models import Task, Project, Comment, TASKSTATE_CHOICES, TASKS_IN_WORK, PROJECTS_IN_WORK, PRIO_CHOICES
3
 from .models import Task, Project, Comment, TASKSTATE_CHOICES, TASKS_IN_WORK, PROJECTS_IN_WORK, PRIO_CHOICES
3
 
4
 
4
 
5
 
5
-try:
6
-    from config import APP_NAME as ROOT_LOGGER_NAME
7
-except ImportError:
8
-    ROOT_LOGGER_NAME = 'root'
9
-logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
6
+logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__)
10
 
7
 
11
 
8
 
12
 def read_attachment(request, rel_path):
9
 def read_attachment(request, rel_path):

+ 13
- 8
context.py View File

1
 from .access import create_project_possible, create_task_possible, acc_task
1
 from .access import create_project_possible, create_task_possible, acc_task
2
+from django.conf import settings
2
 from django.db.models.functions import Lower
3
 from django.db.models.functions import Lower
3
 from django.utils.translation import gettext as _
4
 from django.utils.translation import gettext as _
4
 from .help import actionbar as actionbar_add_help
5
 from .help import actionbar as actionbar_add_help
5
 import inspect
6
 import inspect
7
+import logging
6
 import mycreole
8
 import mycreole
7
 import patt
9
 import patt
8
 from .search import common_searches
10
 from .search import common_searches
10
 from users.context import menubar as menubar_users
12
 from users.context import menubar as menubar_users
11
 from users.context import PROFILE_ENTRY_UID
13
 from users.context import PROFILE_ENTRY_UID
12
 
14
 
15
+logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__)
16
+
13
 ATTACHMENT_UID = 'attachment'
17
 ATTACHMENT_UID = 'attachment'
14
 BACK_UID = 'back'
18
 BACK_UID = 'back'
15
 COMMENTNEW_UID = 'commentnew'
19
 COMMENTNEW_UID = 'commentnew'
28
         context.set_additional_title(kwargs.pop('title'))
32
         context.set_additional_title(kwargs.pop('title'))
29
     except KeyError:
33
     except KeyError:
30
         pass    # no title in kwargs
34
         pass    # no title in kwargs
31
-    menubar_users(context[context.MENUBAR], request)
32
     menubar(context, request, caller_name, **kwargs)
35
     menubar(context, request, caller_name, **kwargs)
33
     actionbar(context, request, caller_name, **kwargs)
36
     actionbar(context, request, caller_name, **kwargs)
34
-    navigationbar(context, request)
37
+    navigationbar(context, request, caller_name, **kwargs)
35
     for key in kwargs:
38
     for key in kwargs:
36
         context[key] = kwargs[key]
39
         context[key] = kwargs[key]
40
+    logger.debug("context adapted: %s", repr(context))
41
+
42
+
43
+def navigationbar(context, request, caller_name, **kwargs):
44
+    bar = context[context.NAVIGATIONBAR]
45
+    add_back_menu(request, bar)
46
+    finalise_bar(request, bar)
37
 
47
 
38
 
48
 
39
 def menubar(context, request, caller_name, **kwargs):
49
 def menubar(context, request, caller_name, **kwargs):
40
     bar = context[context.MENUBAR]
50
     bar = context[context.MENUBAR]
51
+    menubar_users(bar, request)
41
     replace_profile(request, bar)
52
     replace_profile(request, bar)
42
     add_help_menu(request, bar)
53
     add_help_menu(request, bar)
43
     add_tasklist_menu(request, bar)
54
     add_tasklist_menu(request, bar)
47
     finalise_bar(request, bar)
58
     finalise_bar(request, bar)
48
 
59
 
49
 
60
 
50
-def navigationbar(context, request):
51
-    bar = context[context.NAVIGATIONBAR]
52
-    add_back_menu(request, bar)
53
-    finalise_bar(request, bar)
54
-
55
-
56
 def actionbar(context, request, caller_name, **kwargs):
61
 def actionbar(context, request, caller_name, **kwargs):
57
     bar = context[context.ACTIONBAR]
62
     bar = context[context.ACTIONBAR]
58
     if caller_name == 'patt_tasklist':
63
     if caller_name == 'patt_tasklist':

+ 1
- 5
search.py View File

9
 from whoosh.qparser.dateparse import DateParserPlugin
9
 from whoosh.qparser.dateparse import DateParserPlugin
10
 from whoosh import index, qparser
10
 from whoosh import index, qparser
11
 
11
 
12
-try:
13
-    from config import APP_NAME as ROOT_LOGGER_NAME
14
-except ImportError:
15
-    ROOT_LOGGER_NAME = 'root'
16
-logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
12
+logger = logging.getLogger(settings.ROOT_LOGGER_NAME).getChild(__name__)
17
 
13
 
18
 SEARCH_MY_OPEN_TASKS = 1
14
 SEARCH_MY_OPEN_TASKS = 1
19
 SEARCH_LOST_SOULS = 2
15
 SEARCH_LOST_SOULS = 2

Loading…
Cancel
Save