Opened 14 years ago
Closed 13 years ago
#14202 closed Bug (fixed)
Rss201rev2Feed bug
Reported by: | Owned by: | Taylor Mitchell | |
---|---|---|---|
Component: | contrib.syndication | Version: | 1.2 |
Severity: | Normal | Keywords: | Rss201rev2Feed, feedgenerator |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Bug with ...
Even exhample, given here is not working:
>>> from django.utils import feedgenerator >>> feed = feedgenerator.Rss201rev2Feed( ... title=u"Poynter E-Media Tidbits", ... link=u"http://www.poynter.org/column.asp?id=31", ... description=u"A group weblog by the sharpest minds in online media/journalism/publishing.", ... language=u"en", ... ) >>> feed.add_item( ... title="Hello", ... link=u"http://www.holovaty.com/test/", ... description="Testing." ... ) >>> fp = open('test.rss', 'w') >>> feed.write(fp, 'utf-8') /home/denis/svn/trunk/env/django121/django/utils/feedgenerator.pyc in write(self, outfile, encoding) 201 handler.startElement(u"rss", self.rss_attributes()) 202 handler.startElement(u"channel", self.root_attributes()) --> 203 self.add_root_elements(handler) 204 self.write_items(handler) 205 self.endChannelElement(handler) /home/denis/svn/trunk/env/django121/django/utils/feedgenerator.pyc in add_root_elements(self, handler) 220 handler.addQuickElement(u"link", self.feed['link']) 221 handler.addQuickElement(u"description", self.feed['description']) --> 222 handler.addQuickElement(u"atom:link", None, {u"rel": u"self", u"href": self.feed['feed_url']}) 223 if self.feed['language'] is not None: 224 handler.addQuickElement(u"language", self.feed['language']) /home/denis/svn/trunk/env/django121/django/utils/xmlutils.py in addQuickElement(self, name, contents, attrs) 10 print '>>>>>>>>>>', attrs 11 if attrs is None: attrs = {} ---> 12 self.startElement(name, attrs) 13 if contents is not None: 14 self.characters(contents) /usr/lib/python2.5/xml/sax/saxutils.pyc in startElement(self, name, attrs) 130 self._write('<' + name) 131 for (name, value) in attrs.items(): --> 132 self._write(' %s=%s' % (name, quoteattr(value))) 133 self._write('>') 134 /usr/lib/python2.5/xml/sax/saxutils.pyc in quoteattr(data, entities) 71 entities = entities.copy() 72 entities.update({'\n': ' ', '\r': ' ', '\t':'	'}) ---> 73 data = escape(data, entities) 74 if '"' in data: 75 if "'" in data: /usr/lib/python2.5/xml/sax/saxutils.pyc in escape(data, entities) 37 38 # must do ampersand first ---> 39 data = data.replace("&", "&") 40 data = data.replace(">", ">") 41 data = data.replace("<", "<") AttributeError: 'NoneType' object has no attribute 'replace'
Attachments (4)
Change History (15)
comment:1 by , 14 years ago
by , 14 years ago
Attachment: | reproduction_tests.py added |
---|
Reproducing the bug and that feed_url property is causing it
by , 14 years ago
Attachment: | regression_tests.py added |
---|
Regression test to prove that the patch fixes the problem
comment:2 by , 14 years ago
Has patch: | set |
---|
The bug actually concerned django.utils.feedgenerators.RssFeed (which Rss201rev2Feed inherits from). I patched it so that RssFeeds without a feed_url do not render the "atom:link" attribute which is not required by RSS (see http://bit.ly/bAZpKT) and wrote a regression test.
comment:3 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
It's an obvious bug and (sticking to the docs) I bypass the ticket triangers and accept it.
comment:5 by , 14 years ago
Patch needs improvement: | set |
---|
Maybe, because it doesn't have a trunk ready patch which someone can review ?
The patch should include both the fix and unit tests integrated into Django's test suite. The tests are already there, they just need to be put into the right place.
comment:6 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 14 years ago
Attachment: | patch2.diff added |
---|
Patch incorporating code and tests, applies cleanly to trunk
comment:7 by , 14 years ago
Patch needs improvement: | unset |
---|
comment:8 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:9 by , 13 years ago
Easy pickings: | unset |
---|---|
UI/UX: | unset |
why is this still not fixed ? in 1.2.7 ? or even in 1.3.1 ?
comment:10 by , 13 years ago
Since this isn't a major problem, per the backport policy, it is going to be fixed on trunk only, not in the stable banches.
I'm going to commit the fix.
This is my debug string.
self.feedfeed_url is None here: