# HG changeset patch # User Goffi # Date 1371724626 -7200 # Node ID 9a8fbf0e86912971d6bfa66028816b359837f420 # Parent 0e16288d6816b03b736f69635bdb726cdcc20c6a pluging maildir: some trivial fixes: - path is now (local dir)/maildir/(profile name) instead of directly (profile name) - removed forgotten breakpoint - use of MaildirError instead of the inexistant MailboxException - fixed some forgotten "self." diff -r 0e16288d6816 -r 9a8fbf0e8691 src/plugins/plugin_misc_maildir.py --- a/src/plugins/plugin_misc_maildir.py Thu Jun 20 12:14:43 2013 +0200 +++ b/src/plugins/plugin_misc_maildir.py Thu Jun 20 12:37:06 2013 +0200 @@ -30,7 +30,6 @@ import os from cStringIO import StringIO from twisted.internet import reactor -import pdb from sat.core.exceptions import ProfileUnknownError from sat.memory.persistent import PersistentBinaryDict @@ -128,7 +127,7 @@ error(_("INTERNAL ERROR: ") + err_msg) raise MaildirError(err_msg) assert self.__mailboxes[profile][boxname] == mailboxUser - del __mailboxes[profile][boxname] + del self.__mailboxes[profile][boxname] def _checkBoxReference(self, boxname, profile): """Check if there is a reference on a box, and return it @@ -211,7 +210,7 @@ @return: list of strings""" box_data = self.__getBoxData(boxname, profile) if mess_id not in box_data: - raise MailboxException("Trying to get flags from an unexisting message") + raise MaildirError("Trying to get flags from an unexisting message") return box_data[mess_id][1] def setFlags(self, boxname, mess_id, flags, profile): @@ -224,7 +223,7 @@ assert(type(flags) == list) flags = [flag.upper() for flag in flags] # we store every flag UPPERCASE if mess_id not in box_data: - raise MailboxException("Trying to set flags for an unexisting message") + raise MaildirError("Trying to set flags for an unexisting message") box_data[mess_id][1] = flags self.data[profile].force(boxname) @@ -334,14 +333,14 @@ THIS OBJECT MUST NOT BE USED DIRECTLY: use MaildirBox.accessMessageBox instead""" if _maildir._checkBoxReference(name, profile): error("INTERNAL ERROR: MailboxUser MUST NOT be instancied directly") - raise MailboxException('double MailboxUser instanciation') + raise MaildirError('double MailboxUser instanciation') if name != "INBOX": raise NotImplementedError self.name = name self.profile = profile self.maildir = _maildir profile_path = self.maildir._getProfilePath(profile) - full_profile_path = os.path.join(self.maildir.host.memory.getConfig('', 'local_dir'), profile_path) + full_profile_path = os.path.join(self.maildir.host.memory.getConfig('', 'local_dir'), 'maildir', profile_path) if not os.path.exists(full_profile_path): os.makedirs(full_profile_path, 0700) mailbox_path = os.path.join(full_profile_path, MAILDIR_PATH) @@ -363,9 +362,9 @@ self.maildir.cleanTable(self.name, existant_id, profile=self.profile) def __del__(self): - if observer: + if self.observer: debug("removing observer for %s" % self.name) - self._maildir.removeObserver(observer, self.name, "NEW_MESSAGE") + self._maildir.removeObserver(self.observer, self.name, "NEW_MESSAGE") self.maildir._removeBoxAccess(self.name, self, profile=self.profile) def addMessage(self, message): @@ -483,5 +482,4 @@ def emptyTrash(self): """Delete everything in the .Trash dir""" - import shutils - pdb.set_trace() + pass #TODO