Fix str.format() calls for Python 2.6.
Python 2.6 requires a slightly different string formatting that >2.7. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
7e8233131c
commit
a614f9a735
@ -8,6 +8,8 @@ ChangeLog
|
|||||||
WIP (add new stuff for the next release)
|
WIP (add new stuff for the next release)
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
|
* Fix str.format() calls for Python 2.6 (D. Logie)
|
||||||
|
|
||||||
OfflineIMAP v6.5.4 (2012-06-02)
|
OfflineIMAP v6.5.4 (2012-06-02)
|
||||||
=================================
|
=================================
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ class BaseFolder(object):
|
|||||||
self.getmessageuidlist())
|
self.getmessageuidlist())
|
||||||
num_to_copy = len(copylist)
|
num_to_copy = len(copylist)
|
||||||
if num_to_copy and self.repository.account.dryrun:
|
if num_to_copy and self.repository.account.dryrun:
|
||||||
self.ui.info("[DRYRUN] Copy {} messages from {}[{}] to {}".format(
|
self.ui.info("[DRYRUN] Copy {0} messages from {1}[{2}] to {3}".format(
|
||||||
num_to_copy, self, self.repository, dstfolder.repository))
|
num_to_copy, self, self.repository, dstfolder.repository))
|
||||||
return
|
return
|
||||||
for num, uid in enumerate(copylist):
|
for num, uid in enumerate(copylist):
|
||||||
|
@ -301,7 +301,7 @@ class UIBase(object):
|
|||||||
def makefolder(self, repo, foldername):
|
def makefolder(self, repo, foldername):
|
||||||
"""Called when a folder is created"""
|
"""Called when a folder is created"""
|
||||||
prefix = "[DRYRUN] " if self.dryrun else ""
|
prefix = "[DRYRUN] " if self.dryrun else ""
|
||||||
self.info("{}Creating folder {}[{}]".format(
|
self.info("{0}Creating folder {1}[{2}]".format(
|
||||||
prefix, foldername, repo))
|
prefix, foldername, repo))
|
||||||
|
|
||||||
def syncingfolder(self, srcrepos, srcfolder, destrepos, destfolder):
|
def syncingfolder(self, srcrepos, srcfolder, destrepos, destfolder):
|
||||||
@ -346,7 +346,7 @@ class UIBase(object):
|
|||||||
def deletingmessages(self, uidlist, destlist):
|
def deletingmessages(self, uidlist, destlist):
|
||||||
ds = self.folderlist(destlist)
|
ds = self.folderlist(destlist)
|
||||||
prefix = "[DRYRUN] " if self.dryrun else ""
|
prefix = "[DRYRUN] " if self.dryrun else ""
|
||||||
self.info("{}Deleting {} messages ({}) in {}".format(
|
self.info("{0}Deleting {1} messages ({2}) in {3}".format(
|
||||||
prefix, len(uidlist),
|
prefix, len(uidlist),
|
||||||
offlineimap.imaputil.uid_sequence(uidlist), ds))
|
offlineimap.imaputil.uid_sequence(uidlist), ds))
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ class UIBase(object):
|
|||||||
|
|
||||||
def callhook(self, msg):
|
def callhook(self, msg):
|
||||||
if self.dryrun:
|
if self.dryrun:
|
||||||
self.info("[DRYRUN] {}".format(msg))
|
self.info("[DRYRUN] {0}".format(msg))
|
||||||
else:
|
else:
|
||||||
self.info(msg)
|
self.info(msg)
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class OLITestLib():
|
|||||||
reponame: All on `reponame` or all IMAP-type repositories if None"""
|
reponame: All on `reponame` or all IMAP-type repositories if None"""
|
||||||
config = cls.get_default_config()
|
config = cls.get_default_config()
|
||||||
if reponame:
|
if reponame:
|
||||||
sections = ['Repository {}'.format(reponame)]
|
sections = ['Repository {0}'.format(reponame)]
|
||||||
else:
|
else:
|
||||||
sections = [r for r in config.sections() \
|
sections = [r for r in config.sections() \
|
||||||
if r.startswith('Repository')]
|
if r.startswith('Repository')]
|
||||||
@ -162,8 +162,8 @@ class OLITestLib():
|
|||||||
dirs = [d for d in dirs if d.startswith(b'INBOX.OLItest')]
|
dirs = [d for d in dirs if d.startswith(b'INBOX.OLItest')]
|
||||||
for folder in dirs:
|
for folder in dirs:
|
||||||
res_t, data = imapobj.delete(b'\"'+folder+b'\"')
|
res_t, data = imapobj.delete(b'\"'+folder+b'\"')
|
||||||
assert res_t == 'OK', "Folder deletion of {} failed with error"\
|
assert res_t == 'OK', "Folder deletion of {0} failed with error"\
|
||||||
":\n{} {}".format(folder.decode('utf-8'), res_t, data)
|
":\n{1} {2}".format(folder.decode('utf-8'), res_t, data)
|
||||||
imapobj.logout()
|
imapobj.logout()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -197,7 +197,7 @@ class OLITestLib():
|
|||||||
Use some default content if not given"""
|
Use some default content if not given"""
|
||||||
assert cls.testdir != None
|
assert cls.testdir != None
|
||||||
while True: # Loop till we found a unique filename
|
while True: # Loop till we found a unique filename
|
||||||
mailfile = '{}:2,'.format(random.randint(0,999999999))
|
mailfile = '{0}:2,'.format(random.randint(0,999999999))
|
||||||
mailfilepath = os.path.join(cls.testdir, 'mail',
|
mailfilepath = os.path.join(cls.testdir, 'mail',
|
||||||
folder, 'new', mailfile)
|
folder, 'new', mailfile)
|
||||||
if not os.path.isfile(mailfilepath):
|
if not os.path.isfile(mailfilepath):
|
||||||
|
@ -67,7 +67,7 @@ class TestBasicFunctions(unittest.TestCase):
|
|||||||
self.assertEqual(res, "")
|
self.assertEqual(res, "")
|
||||||
boxes, mails = OLITestLib.count_maildir_mails('')
|
boxes, mails = OLITestLib.count_maildir_mails('')
|
||||||
self.assertTrue((boxes, mails)==(0,0), msg="Expected 0 folders and 0 "
|
self.assertTrue((boxes, mails)==(0,0), msg="Expected 0 folders and 0 "
|
||||||
"mails, but sync led to {} folders and {} mails".format(
|
"mails, but sync led to {0} folders and {1} mails".format(
|
||||||
boxes, mails))
|
boxes, mails))
|
||||||
|
|
||||||
def test_02_createdir(self):
|
def test_02_createdir(self):
|
||||||
@ -82,7 +82,7 @@ class TestBasicFunctions(unittest.TestCase):
|
|||||||
self.assertEqual(res, "")
|
self.assertEqual(res, "")
|
||||||
boxes, mails = OLITestLib.count_maildir_mails('')
|
boxes, mails = OLITestLib.count_maildir_mails('')
|
||||||
self.assertTrue((boxes, mails)==(2,0), msg="Expected 2 folders and 0 "
|
self.assertTrue((boxes, mails)==(2,0), msg="Expected 2 folders and 0 "
|
||||||
"mails, but sync led to {} folders and {} mails".format(
|
"mails, but sync led to {0} folders and {1} mails".format(
|
||||||
boxes, mails))
|
boxes, mails))
|
||||||
|
|
||||||
def test_03_nametransmismatch(self):
|
def test_03_nametransmismatch(self):
|
||||||
@ -101,7 +101,7 @@ class TestBasicFunctions(unittest.TestCase):
|
|||||||
mismatch = "ERROR: INFINITE FOLDER CREATION DETECTED!" in res
|
mismatch = "ERROR: INFINITE FOLDER CREATION DETECTED!" in res
|
||||||
self.assertEqual(mismatch, True, msg="Mismatching nametrans rules did "
|
self.assertEqual(mismatch, True, msg="Mismatching nametrans rules did "
|
||||||
"NOT trigger an 'infinite folder generation' error. Output was:\n"
|
"NOT trigger an 'infinite folder generation' error. Output was:\n"
|
||||||
"{}".format(res))
|
"{0}".format(res))
|
||||||
# Write out default config file again
|
# Write out default config file again
|
||||||
OLITestLib.write_config_file()
|
OLITestLib.write_config_file()
|
||||||
|
|
||||||
@ -121,12 +121,12 @@ class TestBasicFunctions(unittest.TestCase):
|
|||||||
self.assertEqual(res, "")
|
self.assertEqual(res, "")
|
||||||
boxes, mails = OLITestLib.count_maildir_mails('')
|
boxes, mails = OLITestLib.count_maildir_mails('')
|
||||||
self.assertTrue((boxes, mails)==(1,1), msg="Expected 1 folders and 1 "
|
self.assertTrue((boxes, mails)==(1,1), msg="Expected 1 folders and 1 "
|
||||||
"mails, but sync led to {} folders and {} mails".format(
|
"mails, but sync led to {0} folders and {1} mails".format(
|
||||||
boxes, mails))
|
boxes, mails))
|
||||||
# The local Mail should have been assigned a proper UID now, check!
|
# The local Mail should have been assigned a proper UID now, check!
|
||||||
uids = OLITestLib.get_maildir_uids('INBOX.OLItest')
|
uids = OLITestLib.get_maildir_uids('INBOX.OLItest')
|
||||||
self.assertFalse (None in uids, msg = "All mails should have been "+ \
|
self.assertFalse (None in uids, msg = "All mails should have been "+ \
|
||||||
"assigned the IMAP's UID number, but {} messages had no valid ID "\
|
"assigned the IMAP's UID number, but {0} messages had no valid ID "\
|
||||||
.format(len([None for x in uids if x==None])))
|
.format(len([None for x in uids if x==None])))
|
||||||
|
|
||||||
def test_05_createfolders(self):
|
def test_05_createfolders(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user