Skip to content

Commit

Permalink
Merge branch 'next' of github.com:OfflineIMAP/offlineimap into next
Browse files Browse the repository at this point in the history
  • Loading branch information
konvpalto committed Jan 31, 2015
2 parents 7ab779a + cb6790b commit fd79baa
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 46 deletions.
58 changes: 56 additions & 2 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,67 @@ ChangeLog
:website: http://offlineimap.org


OfflineIMAP v6.5.7-rc3 (2015- - )
===================================



OfflineIMAP v6.5.7-rc2 (2015-01-18)
===================================

Notes
-----

This release candidate should be minor for most users.

The best points are about SSL not falling back on other authentication methods
when failing, better RAM footprint and reduced I/O access.

Documentation had our attention, too.

There's some code cleanups and code refactoring, as usual.

Features
--------

* Do not keep reloading pyhtonfile, make it stateful.
* HACKING: how to create tags.
* MANUAL: add minor sample on how to retrieve a password with a helper python file.

Fixes
-----

* Make OS-default CA certificate file to be requested explicitely.
* SSL: do not fallback on other authentication mode if it fails.
* Fix regression introduced while style patching.
* API documentation: properly auto-document main class, fixes.
* ui: Machine: remove offending param for a _printData() call.
* Drop caches after having processed folders.

Changes
-------

* Fix unexpected garbage code.
* Properly re-raise exception to save original tracebacks.
* Refactoring: avoid redefining various Python keywords.
* Code: improvements of comments and more style consistency.
* Configuration file: better design and other small improvements.
* nametrans documentation: fix minor error.
* Unused import removal.
* Add a note about the incorrect rendering of the docstring with Sphinx.
* Errors handling: log the messages with level ERROR.
* MAINTAINERS: add mailing list maintainers.
* Fixed copyright statement.
* COPYING: fix unexpected characters.


OfflineIMAP v6.5.7-rc1 (2015-01-07)
===================================

Notes
-----

I think it's time for a new release candidate. Our release cycle are long
I think it's time for a new release candidate. Our release cycles are long
enough and users are asked to use the current TIP of the next branch to test
our recent patches.

Expand Down Expand Up @@ -114,7 +168,7 @@ OfflineIMAP v6.5.6 (2014-05-14)
to Tomasz Żok)


OfflineIMAP v6.5.6-RC1 (2014-05-14)
OfflineIMAP v6.5.6-rc1 (2014-05-14)
===================================

* Add knob to invoke folderfilter dynamically on each sync (GitHub#73)
Expand Down
2 changes: 1 addition & 1 deletion offlineimap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__productname__ = 'OfflineIMAP'
__version__ = "6.5.7"
__revision__ = "-rc1"
__revision__ = "-rc2"
__bigversion__ = __version__ + __revision__
__copyright__ = "Copyright 2002-2015 John Goerzen & contributors"
__author__ = "John Goerzen"
Expand Down
54 changes: 25 additions & 29 deletions offlineimap/folder/LocalStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def storesmessages(self):
def isnewfolder(self):
return not os.path.exists(self.filename)

# Interface from BaseFolder
def getname(self):
return self.name

# Interface from BaseFolder
def getfullname(self):
return self.filename
Expand Down Expand Up @@ -117,33 +113,33 @@ def cachemessagelist(self):
self.messagelist = {}
return

# loop as many times as version, and update format
for i in range(1, self.cur_version+1):
file = open(self.filename, "rt")
# Loop as many times as version, and update format.
for i in range(1, self.cur_version + 1):
self.messagelist = {}
line = file.readline().strip()

# convert from format v1
if line == (self.magicline % 1):
self.ui._msg('Upgrading LocalStatus cache from version 1 to version 2 for %s:%s' %\
(self.repository, self))
self.readstatus_v1(file)
file.close()
cache = open(self.filename, "rt")
line = cache.readline().strip()

# Format is up to date. break.
if line == (self.magicline % self.cur_version):
break

# Convert from format v1.
elif line == (self.magicline % 1):
self.ui._msg('Upgrading LocalStatus cache from version 1'
'to version 2 for %s:%s'% (self.repository, self))
self.readstatus_v1(cache)
cache.close()
self.save()

# NOTE: Add other format transitions here in the future.
# elif line == (self.magicline % 2):
# self.ui._msg('Upgrading LocalStatus cache from version 2 to version 3 for %s:%s' %\
# (self.repository, self))
# self.readstatus_v2(file)
# file.close()
# file.save()

# format is up to date. break
elif line == (self.magicline % self.cur_version):
break
# self.ui._msg(u'Upgrading LocalStatus cache from version 2'
# 'to version 3 for %s:%s'% (self.repository, self))
# self.readstatus_v2(cache)
# cache.close()
# cache.save()

# something is wrong
# Something is wrong.
else:
errstr = "Unrecognized cache magicline in '%s'" % self.filename
self.ui.warn(errstr)
Expand All @@ -152,14 +148,14 @@ def cachemessagelist(self):
if not line:
# The status file is empty - should not have happened,
# but somehow did.
errstr = "Cache file '%s' is empty. Closing..." % self.filename
errstr = "Cache file '%s' is empty."% self.filename
self.ui.warn(errstr)
file.close()
cache.close()
return

assert(line == (self.magicline % self.cur_version))
self.readstatus(file)
file.close()
self.readstatus(cache)
cache.close()

def dropmessagelistcache(self):
self.messagelist = None
Expand Down
15 changes: 7 additions & 8 deletions offlineimap/folder/LocalStatusSQLite.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
import re
from sys import exc_info
from threading import Lock
from .Base import BaseFolder
try:
import sqlite3 as sqlite
except:
pass #fail only if needed later on, not on import

from .Base import BaseFolder


class LocalStatusSQLiteFolder(BaseFolder):
"""LocalStatus backend implemented with an SQLite database
Expand Down Expand Up @@ -56,7 +56,8 @@ def __init__(self, name, repository):
if not os.path.exists(dirname):
os.makedirs(dirname)
if not os.path.isdir(dirname):
raise UserWarning("SQLite database path '%s' is not a directory." % dirname)
raise UserWarning("SQLite database path '%s' is not a directory."%
dirname)

# dblock protects against concurrent writes in same connection
self._dblock = Lock()
Expand All @@ -67,14 +68,15 @@ def __init__(self, name, repository):
except NameError:
# sqlite import had failed
raise UserWarning('SQLite backend chosen, but no sqlite python '
'bindings available. Please install.'), None, exc_info()[2]
'bindings available. Please install.'), None, exc_info()[2]

#Make sure sqlite is in multithreading SERIALIZE mode
assert sqlite.threadsafety == 1, 'Your sqlite is not multithreading safe.'

#Test if db version is current enough and if db is readable.
try:
cursor = self.connection.execute("SELECT value from metadata WHERE key='db_version'")
cursor = self.connection.execute(
"SELECT value from metadata WHERE key='db_version'")
except sqlite.DatabaseError:
#db file missing or corrupt, recreate it.
self.__create_db()
Expand All @@ -88,9 +90,6 @@ def __init__(self, name, repository):
def storesmessages(self):
return False

def getname(self):
return self.name

def getfullname(self):
return self.filename

Expand Down
10 changes: 5 additions & 5 deletions offlineimap/repository/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def __new__(cls, account, reqtype):
name = account.getconf('remoterepository')
# We don't support Maildirs on the remote side.
typemap = {'IMAP': IMAPRepository,
'Gmail': GmailRepository}
'Gmail': GmailRepository}

elif reqtype == 'local':
name = account.getconf('localrepository')
typemap = {'IMAP': MappedIMAPRepository,
'Maildir': MaildirRepository,
'GmailMaildir': GmailMaildirRepository}
'Maildir': MaildirRepository,
'GmailMaildir': GmailMaildirRepository}

elif reqtype == 'status':
# create and return a LocalStatusRepository
Expand All @@ -69,15 +69,15 @@ def __new__(cls, account, reqtype):
errstr = ("Could not find section '%s' in configuration. Required "
"for account '%s'." % ('Repository %s' % name, account))
raise OfflineImapError(errstr, OfflineImapError.ERROR.REPO), \
None, exc_info()[2]
None, exc_info()[2]

try:
repo = typemap[repostype]
except KeyError:
errstr = "'%s' repository not supported for '%s' repositories." \
% (repostype, reqtype)
raise OfflineImapError(errstr, OfflineImapError.ERROR.REPO), \
None, exc_info()[2]
None, exc_info()[2]

return repo(name, account)

Expand Down
2 changes: 1 addition & 1 deletion offlineimap/ui/UIBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def sleep(self, sleepsecs, account):
abortsleep = False
while sleepsecs > 0 and not abortsleep:
if account.get_abort_event():
abortsleep = True
abortsleep = True
else:
abortsleep = self.sleeping(10, sleepsecs)
sleepsecs -= 10
Expand Down

0 comments on commit fd79baa

Please sign in to comment.