[sobjects] silent 3.19 warnings in sobjects/supervising.py
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 09 Apr 2014 18:05:03 +0200
changeset 9753 64d02d18c3c3
parent 9752 5df3ac51a91a
child 9754 54f422ee3deb
[sobjects] silent 3.19 warnings in sobjects/supervising.py
sobjects/supervising.py
--- a/sobjects/supervising.py	Fri Apr 04 18:30:45 2014 +0200
+++ b/sobjects/supervising.py	Wed Apr 09 18:05:03 2014 +0200
@@ -142,16 +142,16 @@
         self.w(u'  %s' % entity.absolute_url())
 
     def _relation_context(self, changedescr):
-        session = self._cw
+        cnx = self._cw
         def describe(eid):
             try:
-                return session._(session.entity_metas(eid)['type']).lower()
+                return cnx._(cnx.entity_metas(eid)['type']).lower()
             except UnknownEid:
                 # may occurs when an entity has been deleted from an external
                 # source and we're cleaning its relation
-                return session._('unknown external entity')
+                return cnx._('unknown external entity')
         eidfrom, rtype, eidto = changedescr.eidfrom, changedescr.rtype, changedescr.eidto
-        return {'rtype': session._(rtype),
+        return {'rtype': cnx._(rtype),
                 'eidfrom': eidfrom,
                 'frometype': describe(eidfrom),
                 'eidto': eidto,
@@ -171,16 +171,15 @@
     of changes
     """
     def _get_view(self):
-        return self.session.vreg['components'].select('supervision_notif',
-                                                      self.session)
+        return self.cnx.vreg['components'].select('supervision_notif', self.cnx)
 
     def _prepare_email(self):
-        session = self.session
-        config = session.vreg.config
+        cnx = self.cnx
+        config = cnx.vreg.config
         uinfo = {'email': config['sender-addr'],
                  'name': config['sender-name']}
         view = self._get_view()
-        content = view.render(changes=session.transaction_data.get('pendingchanges'))
+        content = view.render(changes=cnx.transaction_data.get('pendingchanges'))
         recipients = view.recipients()
         msg = format_mail(uinfo, recipients, content, view.subject(), config=config)
         self.to_send = [(msg, recipients)]