fixed rss serializer again, thanks Charles Winebrinner
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.2.1 (2012-11-04 19:29:10) stable
|
||||
Version 2.2.1 (2012-11-04 19:55:09) stable
|
||||
|
||||
+1
-22
@@ -45,6 +45,7 @@ __author__ = "Andrew Dalke <dalke@dalkescientific.com>"
|
||||
_generator_name = __name__ + "-" + ".".join(map(str, __version__))
|
||||
|
||||
import datetime
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] == 3:
|
||||
@@ -519,25 +520,3 @@ 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 = 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()
|
||||
|
||||
@@ -114,4 +114,4 @@ def rss(feed):
|
||||
description=str(entry.get('description', '')),
|
||||
pubDate=entry.get('created_on', now)
|
||||
) for entry in feed.get('entries', [])])
|
||||
return rss2.dumps(rss)
|
||||
return rss.to_xml(rss,encoding='utf-8')
|
||||
|
||||
Reference in New Issue
Block a user