Package: rss2email
Version: 1:2.62-3
Severity: normal
Tags: patch

Hello!

Attached is a patch to fix up warnings from os.popen2 and md5 when using
Python 2.6.  (Fixes for mimify are still needed, though.)

Thanks!

-Kees

-- 
Kees Cook                                            @debian.org
--- rss2email.py	2009-03-03 10:55:02.000000000 -0800
+++ /usr/share/rss2email/rss2email.py	2009-03-03 10:53:59.000000000 -0800
@@ -91,6 +91,7 @@
 from email.MIMEText import MIMEText
 from email.Header import Header
 from email.Utils import parseaddr, formataddr
+from subprocess import *
 			 
 # Note: You can also override the send function.
 
@@ -185,15 +186,16 @@
 		return smtpserver
 
 	else:
-		i, o = os.popen2(["/usr/sbin/sendmail", recipient])
-		i.write(msg_as_string)
-		i.close(); o.close()
-		pid, status = os.wait()
+		p = Popen(["/usr/sbin/sendmail", recipient],
+			  stdin=PIPE, stdout=PIPE, close_fds=True)
+		p.stdin.write(msg_as_string)
+		p.stdin.close(); p.stdout.close()
+		status = p.wait()
 		if status != 0:
 			print >>warn, ""
 			print >>warn, ('Fatal error: sendmail exited with code %s' % status)
 			sys.exit(1)
-		del i, o
+		del p
 		return None
 
 ## html2text options ##
@@ -219,7 +221,7 @@
 	
 ### Import Modules ###
 
-import cPickle as pickle, md5, time, os, traceback, urllib2, sys, types
+import cPickle as pickle, hashlib, time, os, traceback, urllib2, sys, types
 unix = 0
 try:
 	import fcntl
@@ -347,9 +349,9 @@
 		if 'id' in entry and entry.id: return entry.id
 
 	content = getContent(entry)
-	if content and content != "\n": return md5.new(unu(content)).hexdigest()
+	if content and content != "\n": return hashlib.md5(unu(content)).hexdigest()
 	if 'link' in entry: return entry.link
-	if 'title' in entry: return md5.new(unu(entry.title)).hexdigest()
+	if 'title' in entry: return hashlib.md5(unu(entry.title)).hexdigest()
 
 def getName(r, entry):
 	"""Get the best name."""

Reply via email to