|
@@ -4,17 +4,20 @@ from email.mime.multipart import MIMEMultipart
|
4
|
4
|
from email.mime.text import MIMEText
|
5
|
5
|
|
6
|
6
|
import lxml
|
|
7
|
+import tg
|
7
|
8
|
from lxml.html.diff import htmldiff
|
8
|
9
|
|
9
|
10
|
from mako.template import Template
|
10
|
11
|
|
11
|
12
|
from tg.i18n import lazy_ugettext as l_
|
12
|
13
|
from tg.i18n import ugettext as _
|
|
14
|
+from tg.support.registry import StackedObjectProxy
|
13
|
15
|
|
14
|
16
|
from tracim.lib.base import logger
|
15
|
17
|
from tracim.lib.email import SmtpConfiguration
|
16
|
18
|
from tracim.lib.email import EmailSender
|
17
|
19
|
from tracim.lib.user import UserApi
|
|
20
|
+from tracim.lib.utils import initialize_app
|
18
|
21
|
from tracim.lib.workspace import WorkspaceApi
|
19
|
22
|
|
20
|
23
|
from tracim.model.serializers import Context
|
|
@@ -225,6 +228,13 @@ class EmailNotifier(object):
|
225
|
228
|
user = UserApi(None).get_one(event_actor_id)
|
226
|
229
|
logger.debug(self, 'Content: {}'.format(event_content_id))
|
227
|
230
|
|
|
231
|
+ # HACK, view https://github.com/tracim/tracim/issues/173
|
|
232
|
+ try:
|
|
233
|
+ context = StackedObjectProxy(name="context")
|
|
234
|
+ context.translator
|
|
235
|
+ except TypeError:
|
|
236
|
+ initialize_app(tg.config.get('__file__'))
|
|
237
|
+
|
228
|
238
|
content = ContentApi(user, show_archived=True, show_deleted=True).get_one(event_content_id, ContentType.Any) # TODO - use a system user instead of the user that has triggered the event
|
229
|
239
|
main_content = content.parent if content.type==ContentType.Comment else content
|
230
|
240
|
notifiable_roles = WorkspaceApi(user).get_notifiable_roles(content.workspace)
|