|
@@ -8,15 +8,12 @@ from lxml.html.diff import htmldiff
|
8
|
8
|
|
9
|
9
|
from mako.template import Template
|
10
|
10
|
|
11
|
|
-from tg.i18n import lazy_ugettext as l_
|
12
|
|
-from tg.i18n import ugettext as _
|
13
|
|
-
|
14
|
11
|
from tracim.lib.base import logger
|
15
|
12
|
from tracim.lib.email import SmtpConfiguration
|
16
|
13
|
from tracim.lib.email import EmailSender
|
17
|
14
|
from tracim.lib.user import UserApi
|
18
|
15
|
from tracim.lib.workspace import WorkspaceApi
|
19
|
|
-
|
|
16
|
+from tracim.lib.utils import lazy_ugettext as l_
|
20
|
17
|
from tracim.model.serializers import Context
|
21
|
18
|
from tracim.model.serializers import CTX
|
22
|
19
|
from tracim.model.serializers import DictLikeClass
|
|
@@ -319,72 +316,72 @@ class EmailNotifier(object):
|
319
|
316
|
|
320
|
317
|
action = content.get_last_action().id
|
321
|
318
|
if ActionDescription.COMMENT == action:
|
322
|
|
- content_intro = _('<span id="content-intro-username">{}</span> added a comment:').format(actor.display_name)
|
|
319
|
+ content_intro = l_('<span id="content-intro-username">{}</span> added a comment:').format(actor.display_name)
|
323
|
320
|
content_text = content.description
|
324
|
|
- call_to_action_text = _('Answer')
|
|
321
|
+ call_to_action_text = l_('Answer')
|
325
|
322
|
|
326
|
323
|
elif ActionDescription.CREATION == action:
|
327
|
324
|
|
328
|
325
|
# Default values (if not overriden)
|
329
|
326
|
content_text = content.description
|
330
|
|
- call_to_action_text = _('View online')
|
|
327
|
+ call_to_action_text = l_('View online')
|
331
|
328
|
|
332
|
329
|
if ContentType.Thread == content.type:
|
333
|
|
- call_to_action_text = _('Answer')
|
334
|
|
- content_intro = _('<span id="content-intro-username">{}</span> started a thread entitled:').format(actor.display_name)
|
|
330
|
+ call_to_action_text = l_('Answer')
|
|
331
|
+ content_intro = l_('<span id="content-intro-username">{}</span> started a thread entitled:').format(actor.display_name)
|
335
|
332
|
content_text = '<p id="content-body-intro">{}</p>'.format(content.label) + \
|
336
|
333
|
content.get_last_comment_from(actor).description
|
337
|
334
|
|
338
|
335
|
elif ContentType.File == content.type:
|
339
|
|
- content_intro = _('<span id="content-intro-username">{}</span> added a file entitled:').format(actor.display_name)
|
|
336
|
+ content_intro = l_('<span id="content-intro-username">{}</span> added a file entitled:').format(actor.display_name)
|
340
|
337
|
if content.description:
|
341
|
338
|
content_text = content.description
|
342
|
339
|
else:
|
343
|
340
|
content_text = '<span id="content-body-only-title">{}</span>'.format(content.label)
|
344
|
341
|
|
345
|
342
|
elif ContentType.Page == content.type:
|
346
|
|
- content_intro = _('<span id="content-intro-username">{}</span> added a page entitled:').format(actor.display_name)
|
|
343
|
+ content_intro = l_('<span id="content-intro-username">{}</span> added a page entitled:').format(actor.display_name)
|
347
|
344
|
content_text = '<span id="content-body-only-title">{}</span>'.format(content.label)
|
348
|
345
|
|
349
|
346
|
elif ActionDescription.REVISION == action:
|
350
|
347
|
content_text = content.description
|
351
|
|
- call_to_action_text = _('View online')
|
|
348
|
+ call_to_action_text = l_('View online')
|
352
|
349
|
|
353
|
350
|
if ContentType.File == content.type:
|
354
|
|
- content_intro = _('<span id="content-intro-username">{}</span> uploaded a new revision.').format(actor.display_name)
|
|
351
|
+ content_intro = l_('<span id="content-intro-username">{}</span> uploaded a new revision.').format(actor.display_name)
|
355
|
352
|
content_text = ''
|
356
|
353
|
|
357
|
354
|
elif ContentType.Page == content.type:
|
358
|
|
- content_intro = _('<span id="content-intro-username">{}</span> updated this page.').format(actor.display_name)
|
|
355
|
+ content_intro = l_('<span id="content-intro-username">{}</span> updated this page.').format(actor.display_name)
|
359
|
356
|
previous_revision = content.get_previous_revision()
|
360
|
357
|
title_diff = ''
|
361
|
358
|
if previous_revision.label != content.label:
|
362
|
359
|
title_diff = htmldiff(previous_revision.label, content.label)
|
363
|
|
- content_text = _('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
|
|
360
|
+ content_text = l_('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
|
364
|
361
|
title_diff + \
|
365
|
362
|
htmldiff(previous_revision.description, content.description)
|
366
|
363
|
|
367
|
364
|
elif ContentType.Thread == content.type:
|
368
|
|
- content_intro = _('<span id="content-intro-username">{}</span> updated the thread description.').format(actor.display_name)
|
|
365
|
+ content_intro = l_('<span id="content-intro-username">{}</span> updated the thread description.').format(actor.display_name)
|
369
|
366
|
previous_revision = content.get_previous_revision()
|
370
|
367
|
title_diff = ''
|
371
|
368
|
if previous_revision.label != content.label:
|
372
|
369
|
title_diff = htmldiff(previous_revision.label, content.label)
|
373
|
|
- content_text = _('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
|
|
370
|
+ content_text = l_('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
|
374
|
371
|
title_diff + \
|
375
|
372
|
htmldiff(previous_revision.description, content.description)
|
376
|
373
|
|
377
|
374
|
# elif ContentType.Thread == content.type:
|
378
|
|
- # content_intro = _('<span id="content-intro-username">{}</span> updated this page.').format(actor.display_name)
|
|
375
|
+ # content_intro = l_('<span id="content-intro-username">{}</span> updated this page.').format(actor.display_name)
|
379
|
376
|
# previous_revision = content.get_previous_revision()
|
380
|
|
- # content_text = _('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
|
|
377
|
+ # content_text = l_('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
|
381
|
378
|
# htmldiff(previous_revision.description, content.description)
|
382
|
379
|
|
383
|
380
|
elif ActionDescription.EDITION == action:
|
384
|
|
- call_to_action_text = _('View online')
|
|
381
|
+ call_to_action_text = l_('View online')
|
385
|
382
|
|
386
|
383
|
if ContentType.File == content.type:
|
387
|
|
- content_intro = _('<span id="content-intro-username">{}</span> updated the file description.').format(actor.display_name)
|
|
384
|
+ content_intro = l_('<span id="content-intro-username">{}</span> updated the file description.').format(actor.display_name)
|
388
|
385
|
content_text = '<p id="content-body-intro">{}</p>'.format(content.get_label()) + \
|
389
|
386
|
content.description
|
390
|
387
|
|
|
@@ -404,7 +401,7 @@ class EmailNotifier(object):
|
404
|
401
|
from tracim.config.app_cfg import CFG
|
405
|
402
|
body_content = template.render(
|
406
|
403
|
base_url=self._global_config.WEBSITE_BASE_URL,
|
407
|
|
- _=_,
|
|
404
|
+ _=l_,
|
408
|
405
|
h=helpers,
|
409
|
406
|
user_display_name=role.user.display_name,
|
410
|
407
|
user_role_label=role.role_as_label(),
|