[PATCH] don't choke on <content> with missing type attribute

Bernie Innocenti bernie at codewiz.org
Fri Nov 28 09:49:34 EST 2008


Fix planetplanet so it won't choke on
http://guysoft.wordpress.com/tag/olpc/feed,
which has <content> tags with no type='text/html' attributes.

(I'm not subscribed to this list, please cc me)

--- /var/lib/python-support/python2.5/planet/__init__.py.orig
2008-10-14 10:08:54.000000000 -0400
+++ /var/lib/python-support/python2.5/planet/__init__.py	2008-10-14
10:03:04.000000000 -0400
@@ -879,9 +879,10 @@ class NewsItem(cache.CachedInfo):
                 # Content field: concatenate the values
                 value = ""
                 for item in entry[key]:
-                    if item.type == 'text/html':
+                    type = item.get('type', 'text/html')
+                    if type == 'text/html':
                         item.value = sanitize.HTML(item.value)
-                    elif item.type == 'text/plain':
+                    elif type == 'text/plain':
                         item.value = escape(item.value)
                     if item.has_key('language') and item.language and \
                        (not self._channel.has_key('language') or

-- 
   // Bernie Innocenti - http://www.codewiz.org/
 \X/  Sugar Labs       - http://www.sugarlabs.org/



More information about the devel mailing list