Last active
December 14, 2015 10:59
-
-
Save mekarpeles/5075654 to your computer and use it in GitHub Desktop.
Demonstration of RSS generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#-*- coding: utf-8 -*- | |
import waltz | |
from waltz import track, render | |
from datetime import datetime | |
urls = ('/analytics/?', 'waltz.modules.Analytics', | |
'/rss/?', 'Rss', | |
'/?', 'Index') | |
app = waltz.setup.dancefloor(urls, globals()) | |
class Index: | |
@track | |
def GET(self): | |
return render().index() | |
def items(): | |
"""A function which generates all rss items for this website""" | |
return [{'title': 'Test', | |
'link': 'http://hackerlist.net', | |
'description': 'This is a story', | |
'date': '2013-03-03', | |
'guid': '0' | |
}] | |
Rss = waltz.rss(items, **{'title': 'Waltz Test', | |
'description': 'My example waltz application', | |
'language': 'en-us', | |
'date': datetime.now().ctime(), | |
'generator': 'hackerlist.net', | |
'editor': 'mek', | |
'webmaster': '[email protected]' | |
}) | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment