Преглед изворни кода

Changes due to django_lib update

master
Dirk Alders пре 3 недеља
родитељ
комит
577956248e
3 измењених фајлова са 16 додато и 18 уклоњено
  1. 2
    5
      access.py
  2. 13
    8
      context.py
  3. 1
    5
      search.py

+ 2
- 5
access.py Прегледај датотеку

@@ -1,12 +1,9 @@
1
+from django.conf import settings
1 2
 import logging
2 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 9
 def read_attachment(request, rel_path):

+ 13
- 8
context.py Прегледај датотеку

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

+ 1
- 5
search.py Прегледај датотеку

@@ -9,11 +9,7 @@ from whoosh.fields import Schema, ID, TEXT, NUMERIC, DATETIME, BOOLEAN
9 9
 from whoosh.qparser.dateparse import DateParserPlugin
10 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 14
 SEARCH_MY_OPEN_TASKS = 1
19 15
 SEARCH_LOST_SOULS = 2

Loading…
Откажи
Сачувај