[PATCH 1/3] folder/Base.py: Add getmessageuidlist() as a helper function

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Jan 20 12:16:51 GMT 2011


We often call Folder.getmessagelist().keys() in the code, just to get a
list of message UIDs. This is pretty ugly and confusing, so lets make it
a helper function that describes what we actually do.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/folder/Base.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
index 0f38bc3..953ba70 100644
--- a/offlineimap/folder/Base.py
+++ b/offlineimap/folder/Base.py
@@ -125,8 +125,15 @@ class BaseFolder:
         memory unless this function is called again."""
         raise NotImplementedException
 
+    def getmessageuidlist(self):
+        """Returns the UIDs of all loaded messages as a list
+
+        You must call cachemessagelist() before calling this function!"""
+        return self.getmessagelist().keys()
+
     def getmessagelist(self):
         """Gets the current message list.
+
         You must call cachemessagelist() before calling this function!"""
         raise NotImplementedException
 
-- 
1.7.1





More information about the OfflineIMAP-project mailing list