|
@@ -17,15 +17,11 @@ import os
|
17
|
17
|
from urllib.parse import urlparse
|
18
|
18
|
|
19
|
19
|
from depot.manager import DepotManager
|
20
|
|
-import tg
|
21
|
20
|
from paste.deploy.converters import asbool
|
|
21
|
+import tg
|
22
|
22
|
from tg.configuration.milestones import environment_loaded
|
23
|
|
-
|
24
|
23
|
from tgext.pluggable import plug
|
25
|
24
|
from tgext.pluggable import replace_template
|
26
|
|
-from tracim.lib.system import InterruptManager
|
27
|
|
-
|
28
|
|
-from tracim.lib.utils import lazy_ugettext as l_
|
29
|
25
|
|
30
|
26
|
import tracim
|
31
|
27
|
from tracim.config import TracimAppConfig
|
|
@@ -34,6 +30,8 @@ from tracim.lib.daemons import DaemonsManager
|
34
|
30
|
from tracim.lib.daemons import MailSenderDaemon
|
35
|
31
|
from tracim.lib.daemons import RadicaleDaemon
|
36
|
32
|
from tracim.lib.daemons import WsgiDavDaemon
|
|
33
|
+from tracim.lib.system import InterruptManager
|
|
34
|
+from tracim.lib.utils import lazy_ugettext as l_
|
37
|
35
|
from tracim.model.data import ActionDescription
|
38
|
36
|
from tracim.model.data import ContentType
|
39
|
37
|
|
|
@@ -116,9 +114,7 @@ daemons = DaemonsManager()
|
116
|
114
|
|
117
|
115
|
|
118
|
116
|
def start_daemons(manager: DaemonsManager):
|
119
|
|
- """
|
120
|
|
- Sart Tracim daemons
|
121
|
|
- """
|
|
117
|
+ """Start Tracim daemons."""
|
122
|
118
|
from tg import config
|
123
|
119
|
cfg = CFG.get_instance()
|
124
|
120
|
# Don't start daemons if they are disabled
|
|
@@ -133,9 +129,7 @@ def start_daemons(manager: DaemonsManager):
|
133
|
129
|
|
134
|
130
|
|
135
|
131
|
def configure_depot():
|
136
|
|
- """
|
137
|
|
- Configure Depot
|
138
|
|
- """
|
|
132
|
+ """Configure Depot."""
|
139
|
133
|
depot_storage_name = 'default'
|
140
|
134
|
depot_storage_path = CFG.get_instance().DEPOT_STORAGE_PATH
|
141
|
135
|
depot_storage_settings = {'depot.storage_path': depot_storage_path}
|
|
@@ -200,22 +194,23 @@ If you no longer wish to make the above change, or if you did not initiate this
|
200
|
194
|
|
201
|
195
|
|
202
|
196
|
class CFG(object):
|
203
|
|
- """
|
204
|
|
- Singleton used for easy access to config file parameters
|
205
|
|
- """
|
|
197
|
+ """Singleton used for easy access to config file parameters."""
|
206
|
198
|
|
207
|
199
|
_instance = None
|
208
|
200
|
|
209
|
201
|
@classmethod
|
210
|
202
|
def get_instance(cls) -> 'CFG':
|
|
203
|
+ """Get configuration singleton."""
|
211
|
204
|
if not CFG._instance:
|
212
|
205
|
CFG._instance = CFG()
|
213
|
206
|
return CFG._instance
|
214
|
207
|
|
215
|
208
|
def __setattr__(self, key, value):
|
216
|
209
|
"""
|
217
|
|
- Log-ready setter. this is used for logging configuration (every
|
218
|
|
- parameter except password)
|
|
210
|
+ Log-ready setter.
|
|
211
|
+
|
|
212
|
+ This is used for logging configuration (every parameter except
|
|
213
|
+ password)
|
219
|
214
|
:param key:
|
220
|
215
|
:param value:
|
221
|
216
|
:return:
|
|
@@ -235,7 +230,7 @@ class CFG(object):
|
235
|
230
|
self.__dict__[key] = value
|
236
|
231
|
|
237
|
232
|
def __init__(self):
|
238
|
|
-
|
|
233
|
+ """Parse configuration file."""
|
239
|
234
|
self.DEPOT_STORAGE_PATH = tg.config.get('depot_storage_path')
|
240
|
235
|
self.PREVIEW_CACHE = tg.config.get('preview_cache_dir')
|
241
|
236
|
|
|
@@ -457,6 +452,7 @@ class CFG(object):
|
457
|
452
|
))
|
458
|
453
|
|
459
|
454
|
def get_tracker_js_content(self, js_tracker_file_path=None):
|
|
455
|
+ """Get frontend analytics file."""
|
460
|
456
|
result = ''
|
461
|
457
|
js_tracker_file_path = tg.config.get('js_tracker_path', None)
|
462
|
458
|
if js_tracker_file_path:
|