SF.net SVN: tmda: [2073] trunk/tmda/TMDA/Queue/MaildirQueue.py

[email protected] Thu, 05 Oct 2006 12:44:00 -0700
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2073
          http://svn.sourceforge.net/tmda/?rev=2073&view=rev
Author:   jasonrm
Date:     2006-10-05 12:43:59 -0700 (Thu, 05 Oct 2006)

Log Message:
-----------
reduce typing; glob is the only method in the module.

Modified Paths:
--------------
    trunk/tmda/TMDA/Queue/MaildirQueue.py

Modified: trunk/tmda/TMDA/Queue/MaildirQueue.py
===================================================================
--- trunk/tmda/TMDA/Queue/MaildirQueue.py	2006-10-05 19:11:46 UTC (rev 2072)
+++ trunk/tmda/TMDA/Queue/MaildirQueue.py	2006-10-05 19:43:59 UTC (rev 2073)
@@ -26,10 +26,10 @@
 
 
 from email.Utils import parseaddr
+from glob import glob
 
 
 import fcntl
-import glob
 import os
 import signal
 import socket
@@ -90,9 +90,9 @@
 	lifetimesecs = Util.seconds(Defaults.PENDING_LIFETIME)
 	cwd = os.getcwd()
 	os.chdir(os.path.join(Defaults.PENDING_DIR, 'new'))
-	new_msgs = glob.glob('1*.[0-9]*.*')
+	new_msgs = glob('1*.[0-9]*.*')
 	os.chdir(os.path.join(Defaults.PENDING_DIR, 'cur'))
-	cur_msgs = glob.glob('1*.[0-9]*.*')
+	cur_msgs = glob('1*.[0-9]*.*')
 	os.chdir(cwd)
 	msgs = new_msgs + cur_msgs
 
@@ -128,9 +128,9 @@
     def fetch_ids(self):
 	cwd = os.getcwd()
 	os.chdir(os.path.join(Defaults.PENDING_DIR, 'new'))
-	new_msgs = glob.glob('1*.[0-9]*.*')
+	new_msgs = glob('1*.[0-9]*.*')
 	os.chdir(os.path.join(Defaults.PENDING_DIR, 'cur'))
-	cur_msgs = glob.glob('1*.[0-9]*.*')
+	cur_msgs = glob('1*.[0-9]*.*')
     	ids = ['.'.join(i.split('.')[:2]) 
 	       for i in new_msgs + cur_msgs]
 	os.chdir(cwd)
@@ -151,10 +151,10 @@
 
 
     def fetch_message(self, mailid, fullParse=False):
-	msgs = (glob.glob(os.path.join(Defaults.PENDING_DIR, 'new/') 
-			  + '1*.[0-9]*.*')) + \
-			  (glob.glob(os.path.join(Defaults.PENDING_DIR, 'cur/') 
-				     + '1*.[0-9]*.*'))
+	msgs = (glob(os.path.join(Defaults.PENDING_DIR, 'new/') 
+		     + '1*.[0-9]*.*')) + \
+		     (glob(os.path.join(Defaults.PENDING_DIR, 'cur/') 
+			   + '1*.[0-9]*.*'))
 	for m in msgs:
 	    if mailid in m:
 		msg = Util.msg_from_file(file(m, 'r'),fullParse=fullParse)
@@ -165,10 +165,10 @@
 
 
     def delete_message(self, mailid):
-	msgs = (glob.glob(os.path.join(Defaults.PENDING_DIR, 'new/') 
-			  + '1*.[0-9]*.*')) + \
-			  (glob.glob(os.path.join(Defaults.PENDING_DIR, 'cur/') 
-				     + '1*.[0-9]*.*'))
+	msgs = (glob(os.path.join(Defaults.PENDING_DIR, 'new/') 
+		     + '1*.[0-9]*.*')) + \
+		     (glob(os.path.join(Defaults.PENDING_DIR, 'cur/') 
+			   + '1*.[0-9]*.*'))
 	for m in msgs:
 	    if mailid in m:
 		os.unlink(m)
@@ -177,8 +177,7 @@
     def find_message(self, mailid):
 	cwd = os.getcwd()
 	os.chdir(Defaults.PENDING_DIR)
-	msgs = glob.glob('new/1*.[0-9]*.*') + \
-	    glob.glob('cur/1*.[0-9]*.*')
+	msgs = glob('new/1*.[0-9]*.*') + glob('cur/1*.[0-9]*.*')
 
 	for i in range(5):
 	    for m in msgs:
@@ -189,8 +188,7 @@
 		# retry 5 times in case a MUA moved/renamed the
 		# message to cur/ in a non-atomic way.
 		time.sleep(0.1)
-		msgs = glob.glob('new/1*.[0-9]*.*') + \
-		    glob.glob('cur/1*.[0-9]*.*')
+		msgs = glob('new/1*.[0-9]*.*') + glob('cur/1*.[0-9]*.*')
 		continue
 	# give up; message is not there
 	os.chdir(cwd)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.