[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r21256: {projects} Re-arange email parsing a bit (projects/gettor/lib/gettor)



Author: kaner
Date: 2009-12-18 15:27:19 -0500 (Fri, 18 Dec 2009)
New Revision: 21256

Modified:
   projects/gettor/lib/gettor/requests.py
Log:
Re-arange email parsing a bit


Modified: projects/gettor/lib/gettor/requests.py
===================================================================
--- projects/gettor/lib/gettor/requests.py	2009-12-18 20:23:35 UTC (rev 21255)
+++ projects/gettor/lib/gettor/requests.py	2009-12-18 20:27:19 UTC (rev 21256)
@@ -102,12 +102,18 @@
         if not self.gotPlusReq:
             self.matchLang(text)
         self.checkLang()
-        self.torSpecialPackageExpansion()
     
-        self.matchPackage(text)
-        self.matchSplit(text)
-        self.matchCommand(text)
+        lines = text.split('\n')
+        for line in lines:
+            if self.returnPackage is None:
+                self.matchPackage(line)
+            if self.splitDelivery is False:
+                self.matchSplit(line)
+            if self.commandAddress is None:
+                self.matchCommand(line)
 
+        self.torSpecialPackageExpansion()
+
     def matchPlusAddress(self):
         regexPlus = '.*(<)?(\w+\+(\w+)@\w+(?:\.\w+)+)(?(1)>)'
         match = re.match(regexPlus, self.toAddress)
@@ -126,7 +132,7 @@
             if match: 
                 self.returnPackage = package
                 log.info("User requested package %s" % self.returnPackage)
-                break
+                return
 
     def matchSplit(self, line):
         # If we find 'split' somewhere we assume that the user wants a split