|
1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
2
|
|
|
from urllib.parse import urlparse |
|
3
|
|
|
from paste.deploy.converters import asbool |
|
4
|
|
|
from tracim.lib.utils.logger import logger |
|
5
|
|
|
from depot.manager import DepotManager |
|
6
|
|
|
|
|
7
|
|
|
from pyramid.request import Request |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
class RequestWithCFG(Request): |
|
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
def app_config(self): |
|
|
|
|
|
|
13
|
|
|
cfg = CFG(self.registry.settings) |
|
|
|
|
|
|
14
|
|
|
cfg.configure_filedepot() |
|
15
|
|
|
return cfg |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
class CFG(object): |
|
|
|
|
|
|
19
|
|
|
"""Object used for easy access to config file parameters.""" |
|
20
|
|
|
|
|
21
|
|
|
def __setattr__(self, key, value): |
|
22
|
|
|
""" |
|
23
|
|
|
Log-ready setter. |
|
24
|
|
|
|
|
25
|
|
|
Logs all configuration parameters except password. |
|
26
|
|
|
:param key: |
|
27
|
|
|
:param value: |
|
28
|
|
|
:return: |
|
29
|
|
|
""" |
|
30
|
|
|
if 'PASSWORD' not in key and \ |
|
31
|
|
|
('URL' not in key or type(value) == str) and \ |
|
|
|
|
|
|
32
|
|
|
'CONTENT' not in key: |
|
33
|
|
|
# We do not show PASSWORD for security reason |
|
34
|
|
|
# we do not show URL because At the time of configuration setup, |
|
35
|
|
|
# it can't be evaluated |
|
36
|
|
|
# We do not show CONTENT in order not to pollute log files |
|
37
|
|
|
logger.info(self, 'CONFIG: [ {} | {} ]'.format(key, value)) |
|
38
|
|
|
else: |
|
39
|
|
|
logger.info(self, 'CONFIG: [ {} | <value not shown> ]'.format(key)) |
|
40
|
|
|
|
|
41
|
|
|
self.__dict__[key] = value |
|
42
|
|
|
|
|
43
|
|
|
def __init__(self, settings): |
|
44
|
|
|
"""Parse configuration file.""" |
|
45
|
|
|
|
|
46
|
|
|
### |
|
47
|
|
|
# General |
|
48
|
|
|
### |
|
49
|
|
|
|
|
50
|
|
|
mandatory_msg = \ |
|
51
|
|
|
'ERROR: {} configuration is mandatory. Set it before continuing.' |
|
52
|
|
|
self.DEPOT_STORAGE_DIR = settings.get( |
|
|
|
|
|
|
53
|
|
|
'depot_storage_dir', |
|
54
|
|
|
) |
|
55
|
|
|
if not self.DEPOT_STORAGE_DIR: |
|
56
|
|
|
raise Exception( |
|
57
|
|
|
mandatory_msg.format('depot_storage_dir') |
|
58
|
|
|
) |
|
59
|
|
|
self.DEPOT_STORAGE_NAME = settings.get( |
|
|
|
|
|
|
60
|
|
|
'depot_storage_name', |
|
61
|
|
|
) |
|
62
|
|
|
if not self.DEPOT_STORAGE_NAME: |
|
63
|
|
|
raise Exception( |
|
64
|
|
|
mandatory_msg.format('depot_storage_name') |
|
65
|
|
|
) |
|
66
|
|
|
self.PREVIEW_CACHE_DIR = settings.get( |
|
|
|
|
|
|
67
|
|
|
'preview_cache_dir', |
|
68
|
|
|
) |
|
69
|
|
|
if not self.PREVIEW_CACHE_DIR: |
|
70
|
|
|
raise Exception( |
|
71
|
|
|
'ERROR: preview_cache_dir configuration is mandatory. ' |
|
72
|
|
|
'Set it before continuing.' |
|
73
|
|
|
) |
|
74
|
|
|
|
|
75
|
|
|
self.DATA_UPDATE_ALLOWED_DURATION = int(settings.get( |
|
|
|
|
|
|
76
|
|
|
'content.update.allowed.duration', |
|
77
|
|
|
0, |
|
78
|
|
|
)) |
|
79
|
|
|
|
|
80
|
|
|
self.WEBSITE_TITLE = settings.get( |
|
|
|
|
|
|
81
|
|
|
'website.title', |
|
82
|
|
|
'TRACIM', |
|
83
|
|
|
) |
|
84
|
|
|
|
|
85
|
|
|
self.WEBSITE_BASE_URL = settings.get( |
|
|
|
|
|
|
86
|
|
|
'website.base_url', |
|
87
|
|
|
'', |
|
88
|
|
|
) |
|
89
|
|
|
|
|
90
|
|
|
# TODO - G.M - 26-03-2018 - [Cleanup] These params seems deprecated for tracimv2, # nopep8 |
|
|
|
|
|
|
91
|
|
|
# Verify this |
|
92
|
|
|
# |
|
93
|
|
|
# self.WEBSITE_HOME_TITLE_COLOR = settings.get( |
|
94
|
|
|
# 'website.title.color', |
|
95
|
|
|
# '#555', |
|
96
|
|
|
# ) |
|
97
|
|
|
# self.WEBSITE_HOME_IMAGE_PATH = settings.get( |
|
98
|
|
|
# '/assets/img/home_illustration.jpg', |
|
99
|
|
|
# ) |
|
100
|
|
|
# self.WEBSITE_HOME_BACKGROUND_IMAGE_PATH = settings.get( |
|
101
|
|
|
# '/assets/img/bg.jpg', |
|
102
|
|
|
# ) |
|
103
|
|
|
# |
|
104
|
|
|
|
|
105
|
|
|
self.WEBSITE_SERVER_NAME = settings.get( |
|
|
|
|
|
|
106
|
|
|
'website.server_name', |
|
107
|
|
|
None, |
|
108
|
|
|
) |
|
109
|
|
|
|
|
110
|
|
|
if not self.WEBSITE_SERVER_NAME: |
|
111
|
|
|
self.WEBSITE_SERVER_NAME = urlparse(self.WEBSITE_BASE_URL).hostname |
|
112
|
|
|
logger.warning( |
|
113
|
|
|
self, |
|
114
|
|
|
'NOTE: Generated website.server_name parameter from ' |
|
115
|
|
|
'website.base_url parameter -> {0}' |
|
116
|
|
|
.format(self.WEBSITE_SERVER_NAME) |
|
117
|
|
|
) |
|
118
|
|
|
|
|
119
|
|
|
self.WEBSITE_HOME_TAG_LINE = settings.get( |
|
|
|
|
|
|
120
|
|
|
'website.home.tag_line', |
|
121
|
|
|
'', |
|
122
|
|
|
) |
|
123
|
|
|
self.WEBSITE_SUBTITLE = settings.get( |
|
|
|
|
|
|
124
|
|
|
'website.home.subtitle', |
|
125
|
|
|
'', |
|
126
|
|
|
) |
|
127
|
|
|
self.WEBSITE_HOME_BELOW_LOGIN_FORM = settings.get( |
|
|
|
|
|
|
128
|
|
|
'website.home.below_login_form', |
|
129
|
|
|
'', |
|
130
|
|
|
) |
|
131
|
|
|
|
|
132
|
|
|
self.WEBSITE_TREEVIEW_CONTENT = settings.get( |
|
|
|
|
|
|
133
|
|
|
'website.treeview.content', |
|
134
|
|
|
) |
|
135
|
|
|
|
|
136
|
|
|
self.USER_AUTH_TOKEN_VALIDITY = int(settings.get( |
|
|
|
|
|
|
137
|
|
|
'user.auth_token.validity', |
|
138
|
|
|
'604800', |
|
139
|
|
|
)) |
|
140
|
|
|
|
|
141
|
|
|
# TODO - G.M - 27-03-2018 - [Email] Restore email config |
|
|
|
|
|
|
142
|
|
|
### |
|
143
|
|
|
# EMAIL related stuff (notification, reply) |
|
144
|
|
|
### |
|
145
|
|
|
# |
|
146
|
|
|
# self.EMAIL_NOTIFICATION_NOTIFIED_EVENTS = [ |
|
147
|
|
|
# # ActionDescription.COMMENT, |
|
148
|
|
|
# # ActionDescription.CREATION, |
|
149
|
|
|
# # ActionDescription.EDITION, |
|
150
|
|
|
# # ActionDescription.REVISION, |
|
151
|
|
|
# # ActionDescription.STATUS_UPDATE |
|
152
|
|
|
# ] |
|
153
|
|
|
# |
|
154
|
|
|
# self.EMAIL_NOTIFICATION_NOTIFIED_CONTENTS = [ |
|
155
|
|
|
# # ContentType.Page, |
|
156
|
|
|
# # ContentType.Thread, |
|
157
|
|
|
# # ContentType.File, |
|
158
|
|
|
# # ContentType.Comment, |
|
159
|
|
|
# # ContentType.Folder -- Folder is skipped |
|
160
|
|
|
# ] |
|
161
|
|
|
# if settings.get('email.notification.from'): |
|
162
|
|
|
# raise Exception( |
|
163
|
|
|
# 'email.notification.from configuration is deprecated. ' |
|
164
|
|
|
# 'Use instead email.notification.from.email and ' |
|
165
|
|
|
# 'email.notification.from.default_label.' |
|
166
|
|
|
# ) |
|
167
|
|
|
# |
|
168
|
|
|
# self.EMAIL_NOTIFICATION_FROM_EMAIL = settings.get( |
|
169
|
|
|
# 'email.notification.from.email', |
|
170
|
|
|
# ) |
|
171
|
|
|
# self.EMAIL_NOTIFICATION_FROM_DEFAULT_LABEL = settings.get( |
|
172
|
|
|
# 'email.notification.from.default_label' |
|
173
|
|
|
# ) |
|
174
|
|
|
# self.EMAIL_NOTIFICATION_REPLY_TO_EMAIL = settings.get( |
|
175
|
|
|
# 'email.notification.reply_to.email', |
|
176
|
|
|
# ) |
|
177
|
|
|
# self.EMAIL_NOTIFICATION_REFERENCES_EMAIL = settings.get( |
|
178
|
|
|
# 'email.notification.references.email' |
|
179
|
|
|
# ) |
|
180
|
|
|
# self.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_HTML = settings.get( |
|
181
|
|
|
# 'email.notification.content_update.template.html', |
|
182
|
|
|
# ) |
|
183
|
|
|
# self.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_TEXT = settings.get( |
|
184
|
|
|
# 'email.notification.content_update.template.text', |
|
185
|
|
|
# ) |
|
186
|
|
|
# self.EMAIL_NOTIFICATION_CREATED_ACCOUNT_TEMPLATE_HTML = settings.get( |
|
187
|
|
|
# 'email.notification.created_account.template.html', |
|
188
|
|
|
# './tracim/templates/mail/created_account_body_html.mak', |
|
189
|
|
|
# ) |
|
190
|
|
|
# self.EMAIL_NOTIFICATION_CREATED_ACCOUNT_TEMPLATE_TEXT = settings.get( |
|
191
|
|
|
# 'email.notification.created_account.template.text', |
|
192
|
|
|
# './tracim/templates/mail/created_account_body_text.mak', |
|
193
|
|
|
# ) |
|
194
|
|
|
# self.EMAIL_NOTIFICATION_CONTENT_UPDATE_SUBJECT = settings.get( |
|
195
|
|
|
# 'email.notification.content_update.subject', |
|
196
|
|
|
# ) |
|
197
|
|
|
# self.EMAIL_NOTIFICATION_CREATED_ACCOUNT_SUBJECT = settings.get( |
|
198
|
|
|
# 'email.notification.created_account.subject', |
|
199
|
|
|
# '[{website_title}] Created account', |
|
200
|
|
|
# ) |
|
201
|
|
|
# self.EMAIL_NOTIFICATION_PROCESSING_MODE = settings.get( |
|
202
|
|
|
# 'email.notification.processing_mode', |
|
203
|
|
|
# ) |
|
204
|
|
|
# |
|
205
|
|
|
self.EMAIL_NOTIFICATION_ACTIVATED = asbool(settings.get( |
|
|
|
|
|
|
206
|
|
|
'email.notification.activated', |
|
207
|
|
|
)) |
|
208
|
|
|
# self.EMAIL_NOTIFICATION_SMTP_SERVER = settings.get( |
|
209
|
|
|
# 'email.notification.smtp.server', |
|
210
|
|
|
# ) |
|
211
|
|
|
# self.EMAIL_NOTIFICATION_SMTP_PORT = settings.get( |
|
212
|
|
|
# 'email.notification.smtp.port', |
|
213
|
|
|
# ) |
|
214
|
|
|
# self.EMAIL_NOTIFICATION_SMTP_USER = settings.get( |
|
215
|
|
|
# 'email.notification.smtp.user', |
|
216
|
|
|
# ) |
|
217
|
|
|
# self.EMAIL_NOTIFICATION_SMTP_PASSWORD = settings.get( |
|
218
|
|
|
# 'email.notification.smtp.password', |
|
219
|
|
|
# ) |
|
220
|
|
|
# self.EMAIL_NOTIFICATION_LOG_FILE_PATH = settings.get( |
|
221
|
|
|
# 'email.notification.log_file_path', |
|
222
|
|
|
# None, |
|
223
|
|
|
# ) |
|
224
|
|
|
# |
|
225
|
|
|
# self.EMAIL_REPLY_ACTIVATED = asbool(settings.get( |
|
226
|
|
|
# 'email.reply.activated', |
|
227
|
|
|
# False, |
|
228
|
|
|
# )) |
|
229
|
|
|
# |
|
230
|
|
|
# self.EMAIL_REPLY_IMAP_SERVER = settings.get( |
|
231
|
|
|
# 'email.reply.imap.server', |
|
232
|
|
|
# ) |
|
233
|
|
|
# self.EMAIL_REPLY_IMAP_PORT = settings.get( |
|
234
|
|
|
# 'email.reply.imap.port', |
|
235
|
|
|
# ) |
|
236
|
|
|
# self.EMAIL_REPLY_IMAP_USER = settings.get( |
|
237
|
|
|
# 'email.reply.imap.user', |
|
238
|
|
|
# ) |
|
239
|
|
|
# self.EMAIL_REPLY_IMAP_PASSWORD = settings.get( |
|
240
|
|
|
# 'email.reply.imap.password', |
|
241
|
|
|
# ) |
|
242
|
|
|
# self.EMAIL_REPLY_IMAP_FOLDER = settings.get( |
|
243
|
|
|
# 'email.reply.imap.folder', |
|
244
|
|
|
# ) |
|
245
|
|
|
# self.EMAIL_REPLY_CHECK_HEARTBEAT = int(settings.get( |
|
246
|
|
|
# 'email.reply.check.heartbeat', |
|
247
|
|
|
# 60, |
|
248
|
|
|
# )) |
|
249
|
|
|
# self.EMAIL_REPLY_TOKEN = settings.get( |
|
250
|
|
|
# 'email.reply.token', |
|
251
|
|
|
# ) |
|
252
|
|
|
# self.EMAIL_REPLY_IMAP_USE_SSL = asbool(settings.get( |
|
253
|
|
|
# 'email.reply.imap.use_ssl', |
|
254
|
|
|
# )) |
|
255
|
|
|
# self.EMAIL_REPLY_IMAP_USE_IDLE = asbool(settings.get( |
|
256
|
|
|
# 'email.reply.imap.use_idle', |
|
257
|
|
|
# True, |
|
258
|
|
|
# )) |
|
259
|
|
|
# self.EMAIL_REPLY_CONNECTION_MAX_LIFETIME = int(settings.get( |
|
260
|
|
|
# 'email.reply.connection.max_lifetime', |
|
261
|
|
|
# 600, # 10 minutes |
|
262
|
|
|
# )) |
|
263
|
|
|
# self.EMAIL_REPLY_USE_HTML_PARSING = asbool(settings.get( |
|
264
|
|
|
# 'email.reply.use_html_parsing', |
|
265
|
|
|
# True, |
|
266
|
|
|
# )) |
|
267
|
|
|
# self.EMAIL_REPLY_USE_TXT_PARSING = asbool(settings.get( |
|
268
|
|
|
# 'email.reply.use_txt_parsing', |
|
269
|
|
|
# True, |
|
270
|
|
|
# )) |
|
271
|
|
|
# self.EMAIL_REPLY_LOCKFILE_PATH = settings.get( |
|
272
|
|
|
# 'email.reply.lockfile_path', |
|
273
|
|
|
# '' |
|
274
|
|
|
# ) |
|
275
|
|
|
# if not self.EMAIL_REPLY_LOCKFILE_PATH and self.EMAIL_REPLY_ACTIVATED: |
|
276
|
|
|
# raise Exception( |
|
277
|
|
|
# mandatory_msg.format('email.reply.lockfile_path') |
|
278
|
|
|
# ) |
|
279
|
|
|
# |
|
280
|
|
|
# self.EMAIL_PROCESSING_MODE = settings.get( |
|
281
|
|
|
# 'email.processing_mode', |
|
282
|
|
|
# 'sync', |
|
283
|
|
|
# ).upper() |
|
284
|
|
|
# |
|
285
|
|
|
# if self.EMAIL_PROCESSING_MODE not in ( |
|
286
|
|
|
# self.CST.ASYNC, |
|
287
|
|
|
# self.CST.SYNC, |
|
288
|
|
|
# ): |
|
289
|
|
|
# raise Exception( |
|
290
|
|
|
# 'email.processing_mode ' |
|
291
|
|
|
# 'can ''be "{}" or "{}", not "{}"'.format( |
|
292
|
|
|
# self.CST.ASYNC, |
|
293
|
|
|
# self.CST.SYNC, |
|
294
|
|
|
# self.EMAIL_PROCESSING_MODE, |
|
295
|
|
|
# ) |
|
296
|
|
|
# ) |
|
297
|
|
|
# |
|
298
|
|
|
# self.EMAIL_SENDER_REDIS_HOST = settings.get( |
|
299
|
|
|
# 'email.async.redis.host', |
|
300
|
|
|
# 'localhost', |
|
301
|
|
|
# ) |
|
302
|
|
|
# self.EMAIL_SENDER_REDIS_PORT = int(settings.get( |
|
303
|
|
|
# 'email.async.redis.port', |
|
304
|
|
|
# 6379, |
|
305
|
|
|
# )) |
|
306
|
|
|
# self.EMAIL_SENDER_REDIS_DB = int(settings.get( |
|
307
|
|
|
# 'email.async.redis.db', |
|
308
|
|
|
# 0, |
|
309
|
|
|
# )) |
|
310
|
|
|
|
|
311
|
|
|
### |
|
312
|
|
|
# WSGIDAV (Webdav server) |
|
313
|
|
|
### |
|
314
|
|
|
|
|
315
|
|
|
# TODO - G.M - 27-03-2018 - [WebDav] Restore wsgidav config |
|
|
|
|
|
|
316
|
|
|
#self.WSGIDAV_CONFIG_PATH = settings.get( |
|
317
|
|
|
# 'wsgidav.config_path', |
|
318
|
|
|
# 'wsgidav.conf', |
|
319
|
|
|
#) |
|
320
|
|
|
# TODO: Convert to importlib |
|
|
|
|
|
|
321
|
|
|
# http://stackoverflow.com/questions/41063938/use-importlib-instead-imp-for-non-py-file |
|
322
|
|
|
#self.wsgidav_config = imp.load_source( |
|
323
|
|
|
# 'wsgidav_config', |
|
324
|
|
|
# self.WSGIDAV_CONFIG_PATH, |
|
325
|
|
|
#) |
|
326
|
|
|
# self.WSGIDAV_PORT = self.wsgidav_config.port |
|
327
|
|
|
# self.WSGIDAV_CLIENT_BASE_URL = settings.get( |
|
328
|
|
|
# 'wsgidav.client.base_url', |
|
329
|
|
|
# None, |
|
330
|
|
|
# ) |
|
331
|
|
|
# |
|
332
|
|
|
# if not self.WSGIDAV_CLIENT_BASE_URL: |
|
333
|
|
|
# self.WSGIDAV_CLIENT_BASE_URL = \ |
|
334
|
|
|
# '{0}:{1}'.format( |
|
335
|
|
|
# self.WEBSITE_SERVER_NAME, |
|
336
|
|
|
# self.WSGIDAV_PORT, |
|
337
|
|
|
# ) |
|
338
|
|
|
# logger.warning(self, |
|
339
|
|
|
# 'NOTE: Generated wsgidav.client.base_url parameter with ' |
|
340
|
|
|
# 'followings parameters: website.server_name and ' |
|
341
|
|
|
# 'wsgidav.conf port'.format( |
|
342
|
|
|
# self.WSGIDAV_CLIENT_BASE_URL, |
|
343
|
|
|
# ) |
|
344
|
|
|
# ) |
|
345
|
|
|
# |
|
346
|
|
|
# if not self.WSGIDAV_CLIENT_BASE_URL.endswith('/'): |
|
347
|
|
|
# self.WSGIDAV_CLIENT_BASE_URL += '/' |
|
348
|
|
|
|
|
349
|
|
|
# TODO - G.M - 27-03-2018 - [Caldav] Restore radicale config |
|
|
|
|
|
|
350
|
|
|
### |
|
351
|
|
|
# RADICALE (Caldav server) |
|
352
|
|
|
### |
|
353
|
|
|
# self.RADICALE_SERVER_HOST = settings.get( |
|
354
|
|
|
# 'radicale.server.host', |
|
355
|
|
|
# '127.0.0.1', |
|
356
|
|
|
# ) |
|
357
|
|
|
# self.RADICALE_SERVER_PORT = int(settings.get( |
|
358
|
|
|
# 'radicale.server.port', |
|
359
|
|
|
# 5232, |
|
360
|
|
|
# )) |
|
361
|
|
|
# # Note: Other parameters needed to work in SSL (cert file, etc) |
|
362
|
|
|
# self.RADICALE_SERVER_SSL = asbool(settings.get( |
|
363
|
|
|
# 'radicale.server.ssl', |
|
364
|
|
|
# False, |
|
365
|
|
|
# )) |
|
366
|
|
|
# self.RADICALE_SERVER_FILE_SYSTEM_FOLDER = settings.get( |
|
367
|
|
|
# 'radicale.server.filesystem.folder', |
|
368
|
|
|
# ) |
|
369
|
|
|
# if not self.RADICALE_SERVER_FILE_SYSTEM_FOLDER: |
|
370
|
|
|
# raise Exception( |
|
371
|
|
|
# mandatory_msg.format('radicale.server.filesystem.folder') |
|
372
|
|
|
# ) |
|
373
|
|
|
# self.RADICALE_SERVER_ALLOW_ORIGIN = settings.get( |
|
374
|
|
|
# 'radicale.server.allow_origin', |
|
375
|
|
|
# None, |
|
376
|
|
|
# ) |
|
377
|
|
|
# if not self.RADICALE_SERVER_ALLOW_ORIGIN: |
|
378
|
|
|
# self.RADICALE_SERVER_ALLOW_ORIGIN = self.WEBSITE_BASE_URL |
|
379
|
|
|
# logger.warning(self, |
|
380
|
|
|
# 'NOTE: Generated radicale.server.allow_origin parameter with ' |
|
381
|
|
|
# 'followings parameters: website.base_url ({0})' |
|
382
|
|
|
# .format(self.WEBSITE_BASE_URL) |
|
383
|
|
|
# ) |
|
384
|
|
|
# |
|
385
|
|
|
# self.RADICALE_SERVER_REALM_MESSAGE = settings.get( |
|
386
|
|
|
# 'radicale.server.realm_message', |
|
387
|
|
|
# 'Tracim Calendar - Password Required', |
|
388
|
|
|
# ) |
|
389
|
|
|
# |
|
390
|
|
|
# self.RADICALE_CLIENT_BASE_URL_HOST = settings.get( |
|
391
|
|
|
# 'radicale.client.base_url.host', |
|
392
|
|
|
# 'http://{}:{}'.format( |
|
393
|
|
|
# self.RADICALE_SERVER_HOST, |
|
394
|
|
|
# self.RADICALE_SERVER_PORT, |
|
395
|
|
|
# ), |
|
396
|
|
|
# ) |
|
397
|
|
|
# |
|
398
|
|
|
# self.RADICALE_CLIENT_BASE_URL_PREFIX = settings.get( |
|
399
|
|
|
# 'radicale.client.base_url.prefix', |
|
400
|
|
|
# '/', |
|
401
|
|
|
# ) |
|
402
|
|
|
# # Ensure finished by '/' |
|
403
|
|
|
# if '/' != self.RADICALE_CLIENT_BASE_URL_PREFIX[-1]: |
|
404
|
|
|
# self.RADICALE_CLIENT_BASE_URL_PREFIX += '/' |
|
405
|
|
|
# if '/' != self.RADICALE_CLIENT_BASE_URL_PREFIX[0]: |
|
406
|
|
|
# self.RADICALE_CLIENT_BASE_URL_PREFIX \ |
|
407
|
|
|
# = '/' + self.RADICALE_CLIENT_BASE_URL_PREFIX |
|
408
|
|
|
# |
|
409
|
|
|
# if not self.RADICALE_CLIENT_BASE_URL_HOST: |
|
410
|
|
|
# logger.warning(self, |
|
411
|
|
|
# 'Generated radicale.client.base_url.host parameter with ' |
|
412
|
|
|
# 'followings parameters: website.server_name -> {}' |
|
413
|
|
|
# .format(self.WEBSITE_SERVER_NAME) |
|
414
|
|
|
# ) |
|
415
|
|
|
# self.RADICALE_CLIENT_BASE_URL_HOST = self.WEBSITE_SERVER_NAME |
|
416
|
|
|
# |
|
417
|
|
|
# self.RADICALE_CLIENT_BASE_URL_TEMPLATE = '{}{}'.format( |
|
418
|
|
|
# self.RADICALE_CLIENT_BASE_URL_HOST, |
|
419
|
|
|
# self.RADICALE_CLIENT_BASE_URL_PREFIX, |
|
420
|
|
|
# ) |
|
421
|
|
|
|
|
422
|
|
|
def configure_filedepot(self): |
|
|
|
|
|
|
423
|
|
|
depot_storage_name = self.DEPOT_STORAGE_NAME |
|
424
|
|
|
depot_storage_path = self.DEPOT_STORAGE_DIR |
|
425
|
|
|
depot_storage_settings = {'depot.storage_path': depot_storage_path} |
|
426
|
|
|
DepotManager.configure( |
|
427
|
|
|
depot_storage_name, |
|
428
|
|
|
depot_storage_settings, |
|
429
|
|
|
) |
|
430
|
|
|
|
|
431
|
|
|
class CST(object): |
|
|
|
|
|
|
432
|
|
|
ASYNC = 'ASYNC' |
|
433
|
|
|
SYNC = 'SYNC' |
|
434
|
|
|
|
|
435
|
|
|
TREEVIEW_FOLDERS = 'folders' |
|
436
|
|
|
TREEVIEW_ALL = 'all' |
|
437
|
|
|
|
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.