3535from zope .component import queryUtility
3636from zope .component .factory import Factory
3737from zope .event import notify
38+ from zope .globalrequest import getRequest
3839from zope .i18n import translate
3940from zope .i18nmessageid import Message
4041from zope .interface import implementer
@@ -206,6 +207,7 @@ def Title(self):
206207 default = "Anonymous" ,
207208 ),
208209 ),
210+ context = getRequest (),
209211 )
210212 else :
211213 author_name = self .author_name
@@ -220,8 +222,10 @@ def Title(self):
220222 "author_name" : safe_text (author_name ),
221223 "content" : safe_text (content .Title ()),
222224 },
223- )
225+ ),
226+ context = getRequest (),
224227 )
228+
225229 return title
226230
227231 def Creator (self ):
@@ -381,7 +385,7 @@ def notify_user(obj, event):
381385 if not emails :
382386 return
383387
384- subject = translate (_ ("A comment has been posted." ), context = obj . REQUEST )
388+ subject = translate (_ ("A comment has been posted." ), context = getRequest () )
385389 message = translate (
386390 Message (
387391 MAIL_NOTIFICATION_MESSAGE ,
@@ -391,7 +395,7 @@ def notify_user(obj, event):
391395 "text" : obj .text ,
392396 },
393397 ),
394- context = obj . REQUEST ,
398+ context = getRequest () ,
395399 )
396400 for email in emails :
397401 # Send email
@@ -449,7 +453,7 @@ def notify_moderator(obj, event):
449453 content_object = aq_parent (conversation )
450454
451455 # Compose email
452- subject = translate (_ ("A comment has been posted." ), context = obj . REQUEST )
456+ subject = translate (_ ("A comment has been posted." ), context = getRequest () )
453457 message = translate (
454458 Message (
455459 MAIL_NOTIFICATION_MESSAGE_MODERATOR ,
@@ -465,10 +469,11 @@ def notify_moderator(obj, event):
465469 default = "Anonymous" ,
466470 ),
467471 ),
472+ context = getRequest (),
468473 ),
469474 },
470475 ),
471- context = obj . REQUEST ,
476+ context = getRequest () ,
472477 )
473478
474479 # Send email
0 commit comments