hooks.py
author Florent Cayre <florent.cayre@logilab.fr>
Sun, 14 Jul 2013 22:57:09 +0200
changeset 302 370a454eb55b
parent 208 178d57399aaa
child 294 4c332a5552be
permissions -rw-r--r--
Added tag cubicweb-blog-cenos-version-1.9.6-1 for changeset 6500dc13ddbf

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

class BlogEntryPublishedView(StatusChangeMixIn, NotificationView):
    """get notified from published blogs"""
    __select__ = is_instance('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())