Improved formatting and separation in blocks
[imap-restore-mail] / file_iterator.py
index b8f60ef..5cdc5c0 100644 (file)
@@ -23,28 +23,29 @@ class FileIterator:
 
     def __init__(self):
         """Creates a connection and a user session."""
+
         self.created_mailboxes = []
         self.acl_mailboxes = []
-        return
 
-    def __del__(self):
-        """Closes the connection and the user session."""
         return
 
     @classmethod
     def _message_read(cls, filename):
         """Retrieves a message from the message file."""
+
         try:
             with open(filename, "r") as msgfile:
                 message = msgfile.read()
         except IOError:
             logging.warning("Could not open the e-mail file %s", filename)
             raise
+
         return message
 
     @classmethod
     def load_mailbox_list(cls, mboxlistfile = ""):
-        """Load the list of mailboxes and acl rights for each from file."""        
+        """Load the list of mailboxes and acl rights for each from file."""
+
         mboxdb = {}
         if mboxlistfile != "":
             try:
@@ -70,12 +71,14 @@ class FileIterator:
                         mboxdb[key] = acls
             except IOError:
                 logging.warning("Could not open mboxlist file %s", mboxlistfile)
+
         return mboxdb
 
     def load_mails(self, filepath, mailpath):
         """Loads all e-mails from file hierarchy.
         This recursive generator always returns a tuple of
         the next found (e-mail, mailbox to store, internaldate)."""
+
         logging.debug("Entered directory %s -> %s", filepath, mailpath)
         try:
             filepath = os.path.abspath(filepath)
@@ -116,4 +119,5 @@ class FileIterator:
                     logging.debug("Done with directory %s and mailbox %s", new_filepath, new_mailpath)
         # mark mailboxes that need acl update
         self.acl_mailboxes.append(mailpath)
+
         return
\ No newline at end of file