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:
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)
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