Example #1
0
File: rss.py Project: Kagami/bnw
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')
Example #2
0
 def testValidYoutubeLink(self):
   """
     Verify that link returns a valid youtube link structure
   """
   assert linkify('http://www.youtube.com/watch?v=oAPMuGCa-Ow')
Example #3
0
 def testInvalidLink(self):
   """
     Verify that invalid link returns an exception
   """
   assert not linkify('invalid stuff')
Example #4
0
 def testLinkEmpty(self):
   """
     Verify that empty value returns an exception
   """
   assert not linkify('')
Example #5
0
 def testValidVimeoLink(self):
   """
     Verify that link returns a valid vimeo link structure
   """
   assert linkify('http://vimeo.com/5936810')