hooks.py
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 06 Aug 2013 10:53:45 +0200
changeset 314 268148de1a95
parent 294 4c332a5552be
child 363 4d577ddf2a57
permissions -rw-r--r--
[views] refactor a bit the sitemap rules and make seo a recommend (closes #2551626)

from cubicweb.predicates 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())