Ejemplo n.º 1
0
    def get_item_dict(self, brain):
        obj = brain.getObject()

        description = ""
        if self.context.show_description:
            description = brain.Description
        if self.context.description_length:
            description = utils.crop_text(description, self.context.description_length)

        author = ""
        if utils.can_view_about():
            author = utils.get_creator(obj)

        image_tag = ""
        if INewsListingBaseSchema(self.context).show_lead_image:
            image_tag = obj.restrictedTraverse("@@leadimage")("news_listing_image")

        item = {
            "title": brain.Title,
            "description": description,
            "url": brain.getURL(),
            "author": author,
            "news_date": self.format_date(brain),
            "image_tag": image_tag,
            "brain": brain,
        }
        return item
Ejemplo n.º 2
0
    def get_item_dict(self, brain):
        obj = brain.getObject()

        item = {
            'title': brain.Title,
            'description': brain.Description,
            'url': brain.getURL(),
            'author': utils.get_creator(obj) if utils.can_view_about() else '',
            'news_date': self.format_date(brain),
            'image_tag': obj.restrictedTraverse('@@leadimage')(
                'news_listing_image'),
        }
        return item