def message_feed(messages, link, title, *args, **kwargs): rss_items = [PyRSS2Gen.RSSItem( # author=msg['user'], link=widgets.post_url(msg['id']), guid=widgets.post_url(msg['id']), pubDate=datetime.utcfromtimestamp(msg['date']), categories=set(msg['tags']) | set(msg['clubs']), title='@%s: #%s' % (msg['user'], msg['id']), description=BnwDescription(linkify(msg['text'], msg.get('format')).replace('\n', '<br/>'))) for msg in messages] rss_feed = BnwRSSFeed(title=title, link=link, description=None, docs=None, items=rss_items, *args, **kwargs) rss_feed.selflink = link + '/?format=rss' return rss_feed.to_xml(encoding='utf-8')
def testValidYoutubeLink(self): """ Verify that link returns a valid youtube link structure """ assert linkify('http://www.youtube.com/watch?v=oAPMuGCa-Ow')
def testInvalidLink(self): """ Verify that invalid link returns an exception """ assert not linkify('invalid stuff')
def testLinkEmpty(self): """ Verify that empty value returns an exception """ assert not linkify('')
def testValidVimeoLink(self): """ Verify that link returns a valid vimeo link structure """ assert linkify('http://vimeo.com/5936810')