cubicweb/sobjects/notification.py
changeset 12043 b8d2e6b9f548
parent 11913 4516c3956d46
child 12046 9056a41d91ba
--- a/cubicweb/sobjects/notification.py	Fri Mar 10 18:00:13 2017 +0100
+++ b/cubicweb/sobjects/notification.py	Tue Mar 14 11:07:58 2017 +0100
@@ -32,7 +32,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, InternalManager
+from cubicweb.server.session import Connection, InternalManager
 
 
 class RecipientsFinder(Component):
@@ -120,8 +120,7 @@
                 emailaddr = something.cw_adapt_to('IEmailable').get_email()
                 user = something
             # hi-jack self._cw to get a session for the returned user
-            session = Session(user, self._cw.repo)
-            with session.new_cnx() as cnx:
+            with Connection(self._cw.repo, user) as cnx:
                 self._cw = cnx
                 try:
                     # since the same view (eg self) may be called multiple time and we