Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1:/tmp/cvs-serv20676

Modified Files:
        ChangeLog Pending.py 
Log Message:
Fixed a couple of minor bugs in Pending.py.  Moved use of self.dispose_def
to InteractiveQueue, since it's only used interactively.

An 'or' versus 'and' problem was causing the full summary to print when
neither --summary nor --terse-summary were true.  Also fixed problem where
the message disposal was being printed in non-interactive terse mode.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.245
retrieving revision 1.246
diff -u -r1.245 -r1.246
--- ChangeLog   6 Dec 2002 23:48:12 -0000       1.245
+++ ChangeLog   9 Dec 2002 23:27:55 -0000       1.246
@@ -1,3 +1,32 @@
+2002-12-09  Tim Legant  <[EMAIL PROTECTED]>
+
+       * Pending.py (Queue.__init__): Saved value of dispose as
+       self.dispose and not self.dispose_def.  self.dispose_def is only
+       used interactively and so belongs in InteractiveQueue.
+
+       (Queue.initQueue): Removed re-initialization of self.dispose_def.
+
+       (Queue.checkDelivered): Changed 'delete' compare from
+       self.dispose_def to self.dispose.
+
+       (Queue.disposeMessage): Return 0 now on both self.dispose is None
+       and self.dispose == 'pass'.  self.pretend is not relevant for
+       either of these tests.
+
+       (Queue.showMessage): Summary was getting printed when both
+       self.summary and self.terse were false.  Changed 'or not
+       self.terse' to 'and not self.terse'.
+
+       (Queue.mainLoop): Removed setting of self.dispose from
+       self.dispose_def.  This should only happen interactively and does
+       in InteractiveQueue.userInput.
+
+       (InteractiveQueue.initQueue): New method.  Initialize
+       self.dispose_def here.
+
+       (InteractiveQueue.processMessage): Print blank line if interactive
+       and self.terse is true.
+
 2002-12-06  Jason R. Mastaler  <[EMAIL PROTECTED]>
 
        * Defaults.py (CGI_URL): New variable.

Index: Pending.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Pending.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Pending.py  6 Dec 2002 20:32:39 -0000       1.8
+++ Pending.py  9 Dec 2002 23:27:55 -0000       1.9
@@ -55,7 +55,7 @@
         self.cache = cache
         self.command_recipient = command_recipient
         self.descending = descending
-        self.dispose_def = dispose
+        self.dispose = dispose
         self.older = older
         self.summary = summary
         self.terse = terse
@@ -95,9 +95,6 @@
         if self.descending:
             self.msgs.reverse()
 
-        if self.dispose_def is None:
-            self.dispose_def = 'pass'
-
         return self
     
     def Print(self, *strings):
@@ -189,7 +186,7 @@
     def checkDelivered(self, M):
         """Check if the message has already been delivered."""
         if M.wasDelivered():
-            if self.dispose_def == 'delete':
+            if self.dispose == 'delete':
                 # pretend it isn't delivered if we want to delete
                 # old message, else delivered messages will never
                 # be removed from disk
@@ -199,6 +196,8 @@
 
     def disposeMessage(self, M):
         """Dispose the message."""
+        if self.dispose is None or self.dispose == 'pass':
+            return 0
         if not self.pretend:
             if self.dispose == 'release':
                 M.release()
@@ -208,8 +207,6 @@
                 M.whitelist()
             elif self.dispose == 'blacklist':
                 M.blacklist()
-            elif self.dispose == 'pass':
-                return 0
             elif self.dispose == 'show':
                 self.Print(M.pager())
         return 1
@@ -221,10 +218,10 @@
             
     def showMessage(self, M):
         """Display a message."""
-        if self.summary or not self.terse:
+        if self.summary and not self.terse:
             self.Print()
             self.Print(M.summary(self.count, self.total, self.summary))
-        if self.terse:
+        elif self.terse:
             self.Print(M.terse(tsv=1))
 
     ## Pure virtual method (to be used by InteractiveQueue)
@@ -239,8 +236,6 @@
         self.total = len(self.msgs)
         self.count = 0
         
-        self.dispose = self.dispose_def
-    
         self._loadCache()
             
         for msgid in self.msgs:
@@ -311,12 +306,22 @@
                        pretend)
 
 
+    def initQueue(self):
+        """Additionally initialize the interactive queue."""
+        Queue.initQueue(self)
+        if self.dispose is None:
+            self.dispose_def = 'pass'
+        else:
+            self.dispose_def = self.dispose
+
     def checkDelivered(self, M):
         if M.wasDelivered():
             return 1
         return 0
 
     def processMessage(self, M):
+        if self.terse:
+            self.Print()
         self.showMessage(M)
         if not self.userInput(M):
             return 0

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to