nametrans does not like directories

Sebastian Spaeth Sebastian at SSpaeth.de
Sat Feb 4 20:41:04 GMT 2012


On Wed, 25 Jan 2012 18:03:02 -0500, Allan Wind wrote:
> I was trying to convince nametrans to store Spam, INBOX in=20
> 'received/' + folder.lower(), and Sent in sent. It did not
> seem to be possible through.  There is an assumption somewhere
> that it is returning a file only.

Hi Allan,

excuse me, I am not sure, I understand what you are seeing here. Can you
please give an example of your nametrans that you attempted? nametrans
is all about directories (aka mail folders).

It seems you want something like
nametrans =3D lambda f: "received/"+ f.lower() if f in ['Spam', 'INBOX']
else "sent" if f=3D=3D"Sent" else f

on the remote side?

The reverse on the local side would be something like:
nametrans =3D lambda f:
{"received/spam":"Spam","received/inbox":"INBOX","sent":"Sent"}[f] if f
in ["received/spam","received/inbox","sent"] else f

Admittedly not extremly pretty and you might be better of writing a real
(and more verbose) python function to do the mapping.

> As I had to supply the reverse mapping local repository, I ended=20
> up having the remote repository's nametrans populate a hash with
> suitable values.  Perhaps a suitable idea for the default local=20
> nametrans?

What would you propose here?

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20120204/a7d030a9/attachment.sig>


More information about the OfflineIMAP-project mailing list