From 20f2edfcecfbb14e27a1a9445751ccb0c451eb45 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 1 Dec 2011 09:49:09 +0100 Subject: [PATCH] Sanity check to notify us when we call IMAPRepository.getsep() too early The folder delimiter is only initialized after a call to acquireconnection(), so we must never call this function too early. Include an assert() to make sure we get notified when we do. Signed-off-by: Sebastian Spaeth --- offlineimap/repository/IMAP.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 8c29ee2..8635f7c 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -74,6 +74,13 @@ class IMAPRepository(BaseRepository): return num def getsep(self): + """Return the folder separator for the IMAP repository + + This requires that self.imapserver has been initialized with an + acquireconnection() or it will still be `None`""" + assert self.imapserver.delim != None, "'%s' " \ + "repository called getsep() before the folder separator was " \ + "queried from the server" % self return self.imapserver.delim def gethost(self):