tags 482143 + patch thanks Patch attached.
> <media:content url="http://example.com/quxx.png" medium="image"> > <media:title type="html">baz</media:title> > </media:content> My reading of this is that feedparser can not apply a "type" to this snippet, which planet requires in order to determine what form of escaping the content requires. The attached patch skips "content fields" to which a type has not been assigned, which is safer than simply emitting the content (which the current code does without the failed type lookup, eek). If any content is being lost, we could simply apply HTML sanitation. This change does not result in any changes to the test suite. Regards, -- Chris Lamb, UK [EMAIL PROTECTED] GPG: 0x634F9A20
diff -urNad planet-2.0.orig/planet/__init__.py planet-2.0/planet/__init__.py
--- planet-2.0.orig/planet/__init__.py 2008-05-21 01:55:46.000000000 +0100
+++ planet-2.0/planet/__init__.py 2008-05-21 01:56:22.000000000 +0100
@@ -880,15 +880,18 @@
# Content field: concatenate the values
value = ""
for item in entry[key]:
- if item.type == 'text/html':
- item.value = sanitize.HTML(item.value)
- elif item.type == 'text/plain':
- item.value = escape(item.value)
- if item.has_key('language') and item.language and \
- (not self._channel.has_key('language') or
- item.language != self._channel.language) :
- self.set_as_string(key + "_language", item.language)
- value += cache.utf8(item.value)
+ try:
+ if item.type == 'text/html':
+ item.value = sanitize.HTML(item.value)
+ elif item.type == 'text/plain':
+ item.value = escape(item.value)
+ if item.has_key('language') and item.language and \
+ (not self._channel.has_key('language') or
+ item.language != self._channel.language) :
+ self.set_as_string(key + "_language",
item.language)
+ value += cache.utf8(item.value)
+ except AttributeError:
+ pass
self.set_as_string(key, value)
elif isinstance(entry[key], (str, unicode)):
# String fields
signature.asc
Description: PGP signature

