[PATCH 4/4] learn to not download UIDs defined by the user

Nicolas Sebrecht nicolas.s-dev at laposte.net
Tue Jul 5 23:47:06 BST 2016


On Tue, Jul 05, 2016 at 11:10:42PM +0200, Łukasz Żarnowiecki wrote:
> On Wed, Jun 29, 2016 at 12:04:47AM +0200, Nicolas Sebrecht wrote:
> > diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
> > index 98f78f8..e467f23 100644
> > --- a/offlineimap/folder/Base.py
> > +++ b/offlineimap/folder/Base.py
> > @@ -45,6 +45,7 @@ class BaseFolder(object):
> >          if self.name == 'INBOX':
> >              self.newmail_hook = repository.newmail_hook
> >          self.have_newmail = False
> > +        self.copy_ignoreUIDs = None # List of UIDs to ignore.
> 
> Maybe it would be better to use empty list?  You could then avoid
> checking if it is None plus you would have consitent type.

Initializing members with None instead of empty lists is considered good
practice, too. I don't have strong feelings on this.

> > @@ -75,6 +77,19 @@ class IMAPRepository(BaseRepository):
> >      def dropconnections(self):
> >          self.imapserver.close()
> >  
> > +    def get_copy_ignore_UIDs(self, foldername):
> > +        """Return a list of UIDs to not copy for this foldername."""
> > +
> > +        if self.copy_ignore_eval is None:
> > +            if self.config.has_option(self.getsection(),
> > +                                     'copy_ignore_eval'):
> > +                self.copy_ignore_eval = self.localeval.eval(
> > +                        self.getconf('copy_ignore_eval'))
> > +            else:
> > +                self.copy_ignore_eval = lambda x: None
> 
> lambda: None should be enough ;)

TypeError: <lambda>() takes no arguments (1 given)

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list