Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16118/spambayes

Modified Files:
        ImapUI.py 
Log Message:
Fix [ 1182754 ] 1.1a1: imapfilter browser chokes on incorrect password

Index: ImapUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ImapUI.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** ImapUI.py   14 Apr 2005 06:44:02 -0000      1.46
--- ImapUI.py   13 May 2005 04:24:27 -0000      1.47
***************
*** 109,112 ****
--- 109,125 ----
  )
  
+ 
+ # This is here because we need to refer to it here, and in sb_imapfilter.
+ # I suppose it really belongs somewhere else, where both can refer to it,
+ # but there isn't any such place, and creating it just for this is rather
+ # pointless.
+ class LoginFailure(Exception):
+     """Login to the IMAP server failed."""
+     def __init__(self, details):
+         self.details = details
+     def __str__(self):
+         return "Login failure: %s" % (self.details,)
+ 
+ 
  class IMAPUserInterface(UserInterface.UserInterface):
      """Serves the HTML user interface for the proxies."""
***************
*** 182,185 ****
--- 195,205 ----
                  available_folders.extend(imap.folder_list())
  
+         if not available_folders:
+             content = self._buildBox(_("Error"), None,
+                                      _("No folders available"))
+             self.write(content)
+             self._writePostamble()
+             return
+ 
          content = self.html.configForm.clone()
          content.configFormContent = ""
***************
*** 202,206 ****
          for i in xrange(len(self.imaps)):
              imap = self.imaps[i]
!             new_imaps.append(self._login_to_imap_server(imap, i))
          self.imaps = new_imaps
              
--- 222,228 ----
          for i in xrange(len(self.imaps)):
              imap = self.imaps[i]
!             imap_logged_in = self._login_to_imap_server(imap, i)
!             if imap_logged_in:
!                 new_imaps.append(imap_logged_in)
          self.imaps = new_imaps
              
***************
*** 215,219 ****
                                           _("Please check server/port 
details."))
                  self.write(content)
-                 self._writePostamble()
                  return None
              if server.find(':') > -1:
--- 237,240 ----
***************
*** 231,235 ****
                                           _("Please check server/port 
details."))
                  self.write(content)
-                 self._writePostamble()
                  return None
          usernames = options["imap", "username"]
--- 252,255 ----
***************
*** 238,242 ****
                                       _("Must specify username first."))
              self.write(content)
-             self._writePostamble()
              return None
          if not self.imap_pwds:
--- 258,261 ----
***************
*** 246,250 ****
                                       _("Must specify password first."))
              self.write(content)
-             self._writePostamble()
              return None
          try:
--- 265,268 ----
***************
*** 254,258 ****
                                       _("Please check username/password 
details."))
              self.write(content)
!             self._writePostamble()
              return None
          return imap
--- 272,279 ----
                                       _("Please check username/password 
details."))
              self.write(content)
!             return None
!         except LoginFailure, e:
!             content = self._buildBox(_("Error"), None, str(e))
!             self.write(content)
              return None
          return imap
***************
*** 266,269 ****
--- 287,297 ----
                  available_folders.extend(imap.folder_list())
  
+         if not available_folders:
+             content = self._buildBox(_("Error"), None,
+                                      _("No folders available"))
+             self.write(content)
+             self._writePostamble()
+             return
+ 
          content = self.html.configForm.clone()
          content.configFormContent = ""

_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to