def _brain2news(self, brain):
     """Transform brain into sitemap-ready data."""
     news = {"loc": brain.getURL(), "publication_date": brain.EffectiveDate, "title": brain.Title, "keywords": None}
     obj = brain.getObject()
     if IGoogleNews.providedBy(obj) and obj.news_keywords:
         news["keywords"] = ", ".join(obj.news_keywords)
     return news
 def _brain2news(self, brain):
     """Transform brain into sitemap-ready data."""
     news = {
         'loc': brain.getURL(),
         'publication_date': brain.EffectiveDate,
         'title': brain.Title,
         'keywords': None
     }
     obj = brain.getObject()
     if IGoogleNews.providedBy(obj) and obj.news_keywords:
         news['keywords'] = ', '.join(obj.news_keywords)
     return news
Esempio n. 3
0
    def publish_transition_allowed(self):
        """Check if the publish transition is allowed.

        This workflow guard only takes care of content being published;
        content being edited is checked within an invariant.
        """
        if not IGoogleNews.providedBy(self.context):
            return True  # behavior is not enabled in this context

        if not self.context.standout_journalism:
            return True  # this is not standout journalism

        results = get_current_standout_journalism()
        # there should never be more than 7 items marked as
        # standout journalism at any given time
        assert len(results) <= 7
        if len(results) < 7:
            return True

        return False
 def test_googlenews_behavior(self):
     from collective.googlenews.behaviors.interfaces import IGoogleNews
     self.assertTrue(IGoogleNews.providedBy(self.dummy1))
 def test_googlenews_behavior(self):
     from collective.googlenews.behaviors.interfaces import IGoogleNews
     self.assertTrue(IGoogleNews.providedBy(self.dummy1))