Example #1
0
File: Feed.py Project: Kays/cia-vc
    def render_item(self, context, id, content):
        url = Link.MessageLink(self.target, id).getURL(context)
        m = Message.Message(content)
        tags = [
            tag('link')[ url ],
            tag('dc:date')[ TimeUtil.formatDateISO8601(XML.digValue(m.xml, int, "message", "timestamp")) ],
            tag('description')[ quote(self.formatMessage(m)) ],
            ]

        # Generate a title if we can, but if we can't don't worry too much
        try:
            tags.append(tag('title')[ Formatters.getFactory().findMedium('title', m).formatMessage(m) ])
        except Message.NoFormatterError:
            pass

        return tag('item', **{'rdf:about': url})[tags]
Example #2
0
File: Feed.py Project: Kays/cia-vc
    def messageToItemContent(self, context, m, id):
        """Render an XML message as the content of an RSS <item>"""
        url = Link.MessageLink(self.target, id).getURL(context)
        tags = [
            tag('pubDate')[ TimeUtil.formatDateRFC822(XML.digValue(m.xml, int, "message", "timestamp")) ],
            tag('guid')[url],
            tag('link')[url],
            tag('description')[ quote(self.formatMessage(m)) ],
            ]

        # Generate a title if we can, but if we can't don't worry too much
        try:
            tags.append(tag('title')[ Formatters.getFactory().findMedium('title', m).formatMessage(m) ])
        except Message.NoFormatterError:
            pass

        return tags