Add rss2email v2.54 v2.54
authorAaron Swartz <me@aaronsw.com>
Fri, 27 Aug 2004 12:00:00 +0000 (12:00 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 15 Feb 2013 17:01:46 +0000 (12:01 -0500)
more errors.

Downloaded from:

  http://web.archive.org/web/20050214084518/http://www.aaronsw.com/2002/rss2email/rss2email-2.54.py

rss2email.py

index 9663d1adfa30084202dd9f34e81498a944940048..2221bf1bf0ad7b79723d99acd3a49095d4c083cf 100644 (file)
@@ -10,7 +10,7 @@ Usage:
   list
   delete n
 """
-__version__ = "2.53"
+__version__ = "2.54"
 __author__ = "Aaron Swartz (me@aaronsw.com)"
 __copyright__ = "(C) 2004 Aaron Swartz. GNU GPL 2."
 ___contributors__ = ["Dean Jackson", "Brian Lalor", "Joey Hess", 
@@ -157,23 +157,25 @@ def getContent(entry, HTMLOK=0):
        #    pick the one in the "best" language.
        #  * HACK: hardcoded HTMLOK, should take a tuple of media types
        
+       conts = entry.get('content', [])
+       
        if entry.get('summary_detail', {}):
-               entry.content = entry.get('content', []) + [entry.summary_detail]
+               conts += [entry.summary_detail]
        
-       if entry.get('content', []):
+       if conts:
                if HTMLOK:
-                       for c in entry.content:
+                       for c in conts:
                                if contains(c.type, 'html'): return ('HTML', c.value)
        
-               for c in entry.content:
+               for c in conts:
                        if c.type == 'text/plain': return c.value
        
                if not HTMLOK: # Only need to convert to text if HTML isn't OK
-                       for c in entry.content:
+                       for c in conts:
                                if contains(c.type, 'html'):
                                        return html2text(c.value)
                
-               return entry.content[0].value   
+               return conts[0].value   
        
        return ""
 
@@ -333,6 +335,7 @@ def run(num=None):
                                                print >>warn, "=== SEND THE FOLLOWING TO rss2email@aaronsw.com ==="
                                                print >>warn, "E:", r.get("bozo_exception", "can't process"), f.url
                                                print >>warn, r
+                                               print >>warn, "rss2email", __version__
                                                print >>warn, "feedparser", feedparser.__version__
                                                print >>warn, "html2text", h2t.__version__
                                                print >>warn, "Python", sys.version
@@ -417,6 +420,7 @@ def run(num=None):
                                print >>warn, "=== SEND THE FOLLOWING TO rss2email@aaronsw.com ==="
                                print >>warn, "E: could not parse", f.url
                                traceback.print_exc(file=warn)
+                               print >>warn, "rss2email", __version__
                                print >>warn, "feedparser", feedparser.__version__
                                print >>warn, "html2text", h2t.__version__
                                print >>warn, "Python", sys.version