"""Comment notification hooks :organization: Logilab :copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr """ __docformat__ = "restructuredtext en" from cubicweb import RegistryException from cubicweb.selectors import implements from cubicweb.sobjects import notification class CommentAddedView(notification.NotificationView): """get notified from new comments""" id = 'notif_after_add_relation_comments' __select__ = implements('Comment',) msgid_timestamp = False def subject(self): root = self.entity(self.row, self.col).root() return '%s %s %s' % (self.req._('new comment for'), root.dc_type(), root.dc_title()) def cell_call(self, row, col=0, **kwargs): self.row, self.col = row, col try: view = self.vreg.select_view('fullthreadtext', self.req, self.rset, row=row, col=col) except RegistryException: return return view.render(row=row, col=col, w=self.w, **kwargs)