def title(self):
     """Title is inherited from parent if parent allow subarticles."""
     title = self.context.Title()
     parent = aq_parent(aq_inner(self.context))
     if IArticle.providedBy(parent):
         title = '{} {}'.format(parent.Title(), title)
         parent = aq_parent(parent)
         if IArticle.providedBy(parent):
             return '{} {}'.format(parent.Title(), title)
     return title
    def image_url(self, size=None):
        """Return image url of the article.
        If the image does not exists then returns from parent or fallback image.

        :param size: Size of image such as preview and mini.
        :type size: string

        :rtype: string
        """
        url = '{}/@@images/image'
        if size:
            url = '{}/{}'.format(url, size)

        if self.context.image:
            return url.format(self.context.absolute_url())

        parent = aq_parent(aq_inner(self.context))
        if IArticle.providedBy(parent):
            if parent.image:
                return url.format(parent.absolute_url())

        portal_url = getToolByName(self.context, 'portal_url')()
        return '{}/fallback.png'.format(portal_url)
 def is_article(self):
     return IArticle.providedBy(self.context)