[PATCH] UIDMappedFolder.savemessage() returned nothing, breaking API conventions

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Jun 16 16:22:29 BST 2011

Folder.savemessage() is supposed to return the new UID that a backend
assigned, and it BaseFolder.copymessageto() fails if we don't return a
non-negative number in the savemessage() there.

For some reason, the UIDMappedFolder was not returning anything in
savemessage, despite clearly stating in the code docs that it is
supposed to return a UID. Not sure how long this has already been the
case. This patch fixes the UIDMappedFolder to behave as it should.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
This fixes a real and urgent bug. Thanks for reporting. Patch applies on
top of 'next', not sure if it applies to master too.

 offlineimap/folder/UIDMaps.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py
index 76c5ee4..5f770ce 100644
--- a/offlineimap/folder/UIDMaps.py
+++ b/offlineimap/folder/UIDMaps.py
@@ -197,6 +197,7 @@ class MappingFolderMixIn:
             self._savemaps(dolock = 0)
+        return uid
     def getmessageflags(self, uid):
         return self._mb.getmessageflags(self, self.r2l[uid])

More information about the OfflineIMAP-project mailing list