fixed problem in rss2.py

This commit is contained in:
mdipierro
2012-11-04 18:12:41 -06:00
parent 7de90f18cc
commit 8a137691ff
2 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-11-04 09:14:40) stable
Version 2.2.1 (2012-11-04 18:12:34) stable
+22
View File
@@ -520,3 +520,25 @@ class RSSItem(WriteXmlMixin):
# Derived classes can hook into this to insert
# output after the title and link elements
pass
def dumps(rss, encoding='utf-8'):
s = cStringIO.StringIO()
rss.write_xml(s, encoding)
return s.getvalue()
def test():
rss = RSS2(title='web2py feed', link='http://www.web2py.com',
description='About web2py',
lastBuildDate=datetime.datetime.now(),
items=[RSSItem(title='web2py and PyRSS2Gen-0.0',
link='http://www.web2py.com/examples/simple_examples/getrss',
description='web2py can now make rss feeds!',
guid=Guid('http://www.web2py.com/'),
pubDate=datetime.datetime(2007, 11, 14, 10, 30))])
return dumps(rss)
if __name__ == '__main__':
print test()