/[straw]/straw/src/lib/rssparser.py
ViewVC logotype

Diff of /straw/src/lib/rssparser.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by jmalonzo, Fri Oct 24 09:24:19 2003 UTC revision 1.9 by jmalonzo, Sun Oct 26 10:24:48 2003 UTC
# Line 31  Requires Python 2.2 or later Line 31  Requires Python 2.2 or later
31  Edited by Juri Pakaste, Jan Alonzo  Edited by Juri Pakaste, Jan Alonzo
32    
33  * Added support for blogchannel, freshmeat, creativecommons, and prism modules.  * Added support for blogchannel, freshmeat, creativecommons, and prism modules.
34    * Support for <source url="">...</source> tag
35    
36  """  """
37    
# Line 151  class FeedParser(sgmllib.SGMLParser): Line 152  class FeedParser(sgmllib.SGMLParser):
152          if self.elementstack[-1][0] != element: return          if self.elementstack[-1][0] != element: return
153          element, expectingText, pieces = self.elementstack.pop()          element, expectingText, pieces = self.elementstack.pop()
154          if not expectingText: return          if not expectingText: return
155    
156          output = "".join(pieces)          output = "".join(pieces)
157    
158          output = decodeEntities(output)          output = decodeEntities(output)
159          if self.incontent and self.initem:          if self.incontent and self.initem:
160              if not self.items[-1].has_key(element):              if not self.items[-1].has_key(element):
# Line 162  class FeedParser(sgmllib.SGMLParser): Line 165  class FeedParser(sgmllib.SGMLParser):
165          elif self.inchannel and (not self.intextinput) and (not self.inimage):          elif self.inchannel and (not self.intextinput) and (not self.inimage):
166              self.channel[element] = output              self.channel[element] = output
167    
168    
169      def _addNamespaces(self, attrs):      def _addNamespaces(self, attrs):
170          for prefix, value in attrs:          for prefix, value in attrs:
171              if not prefix.startswith("xmlns:"): continue              if not prefix.startswith("xmlns:"): continue
# Line 180  class FeedParser(sgmllib.SGMLParser): Line 184  class FeedParser(sgmllib.SGMLParser):
184              prefix = self.namespacemap.get(prefix, prefix)              prefix = self.namespacemap.get(prefix, prefix)
185              name = prefix + ':' + suffix              name = prefix + ':' + suffix
186          return name          return name
187            
188      def _getAttribute(self, attrs, name):      def _getAttribute(self, attrs, name):
189          value = [v for k, v in attrs if self._mapToStandardPrefix(k) == name]          value = [v for k, v in attrs if self._mapToStandardPrefix(k) == name]
190          if value:          if value:
# Line 350  class FeedParser(sgmllib.SGMLParser): Line 354  class FeedParser(sgmllib.SGMLParser):
354      def end_id(self):      def end_id(self):
355          self.pop('id')          self.pop('id')
356    
357        # source url
358      def start_source(self, attrs):      def start_source(self, attrs):
         print "source_url yey!"  
359          self.push('source', 1)          self.push('source', 1)
360          value = self._getAttribute(attrs, 'url')          value = self._getAttribute(attrs, 'url')
361          if value:          if value:
362                value += ","
363              self.elementstack[-1][2].append(value)              self.elementstack[-1][2].append(value)
364    
365        def end_source(self):
366          self.pop('source')          self.pop('source')
367    
368      # Creative Commons Licenses (RSS)      # Creative Commons Licenses (RSS)

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26