Sync -> Mails there. Sync -> mails gone

Tomasz Żok tomasz.zok at gmail.com
Thu Jan 29 12:28:33 GMT 2015


On 2015-01-29 at 12:35, Matthias Beyer wrote:
> On 29-01-2015 12:13:11, Tomasz Żok wrote:
> >
> > 2.  Change LocalFoo's nametrans into:
> >         lambda foldername = if foldername == 'localPREFIX.INBOX' then 'INBOX' else 'INBOX.' + re.sub('^localPREFIX\.', '', foldername)
> >

Oh, sorry... I should have never posted without testing my own snippets.

The correct way to do it in Python would be:
    lambda foldername: 'INBOX' if foldername == 'localPREFIX.INBOX' else 'INBOX.' + re.sub('^localPREFIX\.', '', foldername)


I tested it this time:

In [1]: import re

In [2]: x = lambda foldername: 'INBOX' if foldername == 'localPREFIX.INBOX' else 'INBOX.' + re.sub('^localPREFIX\.', '', foldername)

In [3]: x('localPREFIX.INBOX')
Out[3]: 'INBOX'

In [4]: x('localPREFIX.Example')
Out[4]: 'INBOX.Example'


Can you try it now?
Regards,
Tomasz




More information about the OfflineIMAP-project mailing list