hooks.py
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 09 May 2010 20:20:48 +0200
changeset 205 246ca4f3030e
parent 182 b0b42cfa25e3
child 208 178d57399aaa
permissions -rw-r--r--
backport stable

from cubicweb.selectors import implements, is_in_state
from cubicweb.sobjects.notification import NotificationView, StatusChangeMixIn

class BlogEntryPublishedView(StatusChangeMixIn, NotificationView):
    """get notified from published blogs"""
    __select__ = implements('BlogEntry',) & is_in_state('published')
    content_attr = 'content'

    def subject(self):
        entity = self.cw_rset.get_entity(0, 0)
        return '[%s] %s' % (self._cw.vreg.config.appid, entity.dc_title())