Skip to content

Instantly share code, notes, and snippets.

@mekarpeles
Last active December 14, 2015 10:59
Show Gist options
  • Save mekarpeles/5075654 to your computer and use it in GitHub Desktop.
Save mekarpeles/5075654 to your computer and use it in GitHub Desktop.
Demonstration of RSS generation
#!/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