Package: rss2email
Version: 1:2.60-5
Tags: patch
Severity: normal

The ability to override the From: field of the mail via
OVERRIDE_FROM is misleading. It just allows to override
the From: name, but not the email address. The attached
patch correct this. Additionally it is an simpler way
as #349061 proposes to get a mail that is easy filterable
by procmail.


        Bernhard Kauer

--- rss2email.py.old	2007-08-09 17:24:12.000000000 +0200
+++ rss2email.py	2007-08-09 17:20:34.000000000 +0200
@@ -347,8 +347,6 @@
 	"""Get the best name."""
 
 	feed = r.feed
-	if r.url in OVERRIDE_FROM.keys():
-		return OVERRIDE_FROM[r.url]
 
 	name = feed.get('title', '')
 
@@ -368,11 +366,14 @@
 
 	return name
 
-def getEmail(feed, entry):
+def getEmail(r, entry):
 	"""Get the best email_address."""
 
 	if FORCE_FROM: return DEFAULT_FROM
+	feed = r.feed
 
+	if r.url in OVERRIDE_FROM.keys():
+			return OVERRIDE_FROM[r.url]
 	if 'email' in entry.get('author_detail', []):
 		return entry.author_detail.email
 
@@ -576,7 +577,7 @@
 
 					link = entry.get('link', "")
 
-					from_addr = getEmail(r.feed, entry)
+					from_addr = getEmail(r, entry)
 
 					name = getName(r, entry)
 					fromhdr = '"'+ name + '" <' + from_addr + ">"

Reply via email to