[notification] merge BaseNotificationView and NotificationView
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 25 Apr 2013 13:35:02 +0200
changeset 8932 4ae4242bceb1
parent 8931 4b195bd82e8b
child 8933 ac76925268a3
[notification] merge BaseNotificationView and NotificationView They are in the same module now.
sobjects/notification.py
--- a/sobjects/notification.py	Thu Apr 25 13:34:48 2013 +0200
+++ b/sobjects/notification.py	Thu Apr 25 13:35:02 2013 +0200
@@ -65,12 +65,10 @@
     """raise this if you decide to skip an email during its generation"""
 
 
-class BaseNotificationView(EntityView):
+class NotificationView(EntityView):
     """abstract view implementing the "email" API (eg to simplify sending
     notification)
     """
-    __abstract__ = True
-
     # XXX refactor this class to work with len(rset) > 1
 
     msgid_timestamp = True
@@ -162,9 +160,8 @@
         self._cw.vreg.config.sendmails([(msg, recipients)])
 
     def send_on_commit(self, recipients, msg):
-        raise NotImplementedError
-
-    send = send_now
+        SendMailOp(self._cw, recipients=recipients, msg=msg)
+    send = send_on_commit
 
     # email generation helpers #################################################
 
@@ -200,15 +197,6 @@
         return kwargs
 
 
-class NotificationView(BaseNotificationView):
-    """overriden to delay actual sending of mails to a commit operation by
-    default
-    """
-    def send_on_commit(self, recipients, msg):
-        SendMailOp(self._cw, recipients=recipients, msg=msg)
-    send = send_on_commit
-
-
 class StatusChangeMixIn(object):
     __regid__ = 'notif_status_change'
     msgid_timestamp = True