Upgrade to the latest feedparser

This commit is contained in:
Sam Ruby 2006-08-16 12:47:22 -04:00
parent cf8144b85e
commit 2a7e7b83df

View File

@ -11,7 +11,7 @@ Recommended: Python 2.3 or later
Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/> Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/>
""" """
__version__ = "4.2-pre-" + "$Revision: 1.129 $"[11:15] + "-cvs" __version__ = "4.2-pre-" + "$Revision: 1.131 $"[11:16] + "-cvs"
__license__ = """Copyright (c) 2002-2006, Mark Pilgrim, All rights reserved. __license__ = """Copyright (c) 2002-2006, Mark Pilgrim, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@ -790,7 +790,7 @@ class _FeedParserMixin:
contentparams = copy.deepcopy(self.contentparams) contentparams = copy.deepcopy(self.contentparams)
contentparams['value'] = output contentparams['value'] = output
self.entries[-1][element + '_detail'] = contentparams self.entries[-1][element + '_detail'] = contentparams
elif (self.infeed or self.insource) and (not self.intextinput) and (not self.inimage): elif (self.infeed or self.insource):# and (not self.intextinput) and (not self.inimage):
context = self._getContext() context = self._getContext()
if element == 'description': if element == 'description':
element = 'subtitle' element = 'subtitle'
@ -933,20 +933,20 @@ class _FeedParserMixin:
_end_feed = _end_channel _end_feed = _end_channel
def _start_image(self, attrsD): def _start_image(self, attrsD):
self.inimage = 1
self.push('image', 0)
context = self._getContext() context = self._getContext()
context.setdefault('image', FeedParserDict()) context.setdefault('image', FeedParserDict())
self.inimage = 1
self.push('image', 0)
def _end_image(self): def _end_image(self):
self.pop('image') self.pop('image')
self.inimage = 0 self.inimage = 0
def _start_textinput(self, attrsD): def _start_textinput(self, attrsD):
self.intextinput = 1
self.push('textinput', 0)
context = self._getContext() context = self._getContext()
context.setdefault('textinput', FeedParserDict()) context.setdefault('textinput', FeedParserDict())
self.intextinput = 1
self.push('textinput', 0)
_start_textInput = _start_textinput _start_textInput = _start_textinput
def _end_textinput(self): def _end_textinput(self):
@ -1016,7 +1016,7 @@ class _FeedParserMixin:
self._save_contributor('name', value) self._save_contributor('name', value)
elif self.intextinput: elif self.intextinput:
context = self._getContext() context = self._getContext()
context['textinput']['name'] = value context['name'] = value
_end_itunes_name = _end_name _end_itunes_name = _end_name
def _start_width(self, attrsD): def _start_width(self, attrsD):
@ -1030,7 +1030,7 @@ class _FeedParserMixin:
value = 0 value = 0
if self.inimage: if self.inimage:
context = self._getContext() context = self._getContext()
context['image']['width'] = value context['width'] = value
def _start_height(self, attrsD): def _start_height(self, attrsD):
self.push('height', 0) self.push('height', 0)
@ -1043,7 +1043,7 @@ class _FeedParserMixin:
value = 0 value = 0
if self.inimage: if self.inimage:
context = self._getContext() context = self._getContext()
context['image']['height'] = value context['height'] = value
def _start_url(self, attrsD): def _start_url(self, attrsD):
self.push('href', 1) self.push('href', 1)
@ -1056,12 +1056,6 @@ class _FeedParserMixin:
self._save_author('href', value) self._save_author('href', value)
elif self.incontributor: elif self.incontributor:
self._save_contributor('href', value) self._save_contributor('href', value)
elif self.inimage:
context = self._getContext()
context['image']['href'] = value
elif self.intextinput:
context = self._getContext()
context['textinput']['link'] = value
_end_homepage = _end_url _end_homepage = _end_url
_end_uri = _end_url _end_uri = _end_url
@ -1082,6 +1076,10 @@ class _FeedParserMixin:
def _getContext(self): def _getContext(self):
if self.insource: if self.insource:
context = self.sourcedata context = self.sourcedata
elif self.inimage:
context = self.feeddata['image']
elif self.intextinput:
context = self.feeddata['textinput']
elif self.inentry: elif self.inentry:
context = self.entries[-1] context = self.entries[-1]
else: else:
@ -1315,10 +1313,6 @@ class _FeedParserMixin:
def _end_link(self): def _end_link(self):
value = self.pop('link') value = self.pop('link')
context = self._getContext() context = self._getContext()
if self.intextinput:
context['textinput']['link'] = value
if self.inimage:
context['image']['link'] = value
_end_producturl = _end_link _end_producturl = _end_link
def _start_guid(self, attrsD): def _start_guid(self, attrsD):
@ -1343,10 +1337,6 @@ class _FeedParserMixin:
value = self.popContent('title') value = self.popContent('title')
if not value: return if not value: return
context = self._getContext() context = self._getContext()
if self.intextinput:
context['textinput']['title'] = value
elif self.inimage:
context['image']['title'] = value
_end_dc_title = _end_title _end_dc_title = _end_title
_end_media_title = _end_title _end_media_title = _end_title
@ -1366,11 +1356,6 @@ class _FeedParserMixin:
self._end_content() self._end_content()
else: else:
value = self.popContent('description') value = self.popContent('description')
context = self._getContext()
if self.intextinput:
context['textinput']['description'] = value
elif self.inimage:
context['image']['description'] = value
self._summaryKey = None self._summaryKey = None
_end_abstract = _end_description _end_abstract = _end_description