Package: rss2email
Version: 1:2.54-2
Severity: normal
Tags: patch

Joshua Kwan <[EMAIL PROTECTED]> mentioned the following bug on IRC
yesterday:

04:57 < joshk> hrm
04:57 < joshk> E: could not parse http://www.ipodlinux.org/blog/wp-rss.php
04:57 < joshk> Traceback (most recent call last):
04:57 < joshk>   File "/usr/share/rss2email/rss2email.py", line 384, in run
04:57 < joshk>     message = (
04:57 < joshk> UnboundLocalError: local variable 'default_to' referenced before 
assignment
04:57 < joshk> what have i done wrong?
04:57 < joshk> mm
04:58 < joshk> it should say i need to run 'r2e email

This is quite easy to reproduce:

3783:[EMAIL PROTECTED]: ~] rm -rf .rss2email
3784:[EMAIL PROTECTED]: ~] r2e new
3785:[EMAIL PROTECTED]: ~] r2e add 'http://www.cyrius.com/journal/?flav=atom'
3786:[EMAIL PROTECTED]: ~] r2e list
0: http://www.cyrius.com/journal/?flav=atom
Traceback (most recent call last):
  File "/usr/share/rss2email/rss2email.py", line 489, in ?
    elif action == "list": list()
  File "/usr/share/rss2email/rss2email.py", line 449, in list
    print `i`+':', f.url, '('+(f.to or ('default: '+default_to))+')'
UnboundLocalError: local variable 'default_to' referenced before assignment
zsh: exit 1     r2e list
3787:[EMAIL PROTECTED]: ~] r2e run
=== SEND THE FOLLOWING TO [EMAIL PROTECTED] ===
E: could not parse http://www.cyrius.com/journal/?flav=atom
Traceback (most recent call last):
  File "/usr/share/rss2email/rss2email.py", line 392, in run
    message = (
UnboundLocalError: local variable 'default_to' referenced before assignment
rss2email 2.54
feedparser 3.3
html2text 2.2
Python 2.3.5 (#2, May  4 2005, 08:51:39)
[GCC 3.3.5 (Debian 1:3.3.5-12)]
=== END HERE ===


With the patch below, you get this:

3826:[EMAIL PROTECTED]: ~] rm -rf .rss2email
3827:[EMAIL PROTECTED]: ~] r2e new
3828:[EMAIL PROTECTED]: ~] r2e add 'http://www.cyrius.com/journal/?flav=atom'
3829:[EMAIL PROTECTED]: ~] r2e add 'http://www.cyrius.com/journal/?flav=atom' 
[EMAIL PROTECTED]
3830:[EMAIL PROTECTED]: ~] r2e list
0: http://www.cyrius.com/journal/?flav=atom (default: )
   W: Please define a default address with 'r2e email addr'
1: http://www.cyrius.com/journal/?flav=atom ([EMAIL PROTECTED])
3831:[EMAIL PROTECTED]: ~] r2e run
No default email address defined. Please run 'r2e email addr'
Ignoring feed http://www.cyrius.com/journal/?flav=atom
3832:[EMAIL PROTECTED]: ~]



--- rss2email.py~       2005-05-23 21:52:38.728516272 +0100
+++ rss2email.py        2005-05-23 22:05:53.343716400 +0100
@@ -283,6 +283,7 @@
        try:
                # We store the default to address as the first item in the 
feeds list.
                # Here we take it out and save it for later.
+               default_to = ""
                if feeds and isstr(feeds[0]): default_to = feeds[0]; ifeeds = 
feeds[1:] 
                else: ifeeds = feeds
                
@@ -367,6 +368,11 @@
                                        
                                        if f.seen.has_key(frameid) and 
f.seen[frameid] == id: continue
                                                                                
+                                       if not (f.to or default_to):
+                                               print "No default email address 
defined. Please run 'r2e email addr'"
+                                               print "Ignoring feed %s" % f.url
+                                               break
+
                                        if 'title_detail' in entry and 
entry.title_detail:
                                                title = entry.title_detail.value
                                                if 
contains(entry.title_detail.type, 'html'):
@@ -441,12 +447,15 @@
 def list():
        feeds, feedfileObject = load(lock=0)
        
+       default_to = ""
        if feeds and isstr(feeds[0]):
                default_to = feeds[0]; ifeeds = feeds[1:]; i=1
                print "default email:", default_to
        else: ifeeds = feeds; i = 0
        for f in ifeeds:
                print `i`+':', f.url, '('+(f.to or ('default: '+default_to))+')'
+               if not (f.to or default_to):
+                       print "   W: Please define a default address with 'r2e 
email addr'"
                i+= 1
 
 def delete(n):




-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.10-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages rss2email depends on:
ii  python                        2.3.5-2    An interactive high-level object-o

-- no debconf information

-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to