[mail] drop hijack_user usage
The transaction is now commited before notification. We can create a new session
directly and drop `hijack_user` usage.
This prepare #2781782
--- a/sobjects/notification.py Thu Apr 25 13:35:02 2013 +0200
+++ b/sobjects/notification.py Thu Apr 25 12:24:26 2013 +0200
@@ -30,6 +30,7 @@
from cubicweb.view import Component, EntityView
from cubicweb.server.hook import SendMailOp
from cubicweb.mail import construct_message_id, format_mail
+from cubicweb.server.session import Session
class RecipientsFinder(Component):
@@ -118,7 +119,7 @@
for something in recipients:
if isinstance(something, Entity):
# hi-jack self._cw to get a session for the returned user
- self._cw = self._cw.hijack_user(something)
+ self._cw = Session(self._cw.repo, something)
emailaddr = something.cw_adapt_to('IEmailable').get_email()
else:
emailaddr, lang = something