Spaces in foldernames for the -f cli flag

Will Styler william.styler at colorado.edu
Tue Apr 5 17:36:36 BST 2011


On Tue, Apr 05, 2011 at 11:27:04AM +0200, Sebastian Spaeth wrote:
> On Mon, 4 Apr 2011 22:59:49 -0600, Will Styler <william.styler at colorado.edu> wrote:
> > I cannot get the other two ("Deleted Messages" and "Sent Message") to
> > sync with this command, no matter how I escape them.  I've tried quotes,
> > brackets and slashes, backslashes, plain... I'm at the end of my rope.  
> 
> no wonder, see below:
>  
> > So, any suggestions on how I can ask offlineimap to check these other
> > folders alongside INBOX from the CLI?
> 
> > /opt/local/bin/offlineimap -o -u Noninteractive.Quiet -f INBOX,[Deleted\
> > Messages],[Sent\ Messages] >/dev/null
> 
> Mmmh, specifying folders on the command line seems to strip away *all*
> spaces (which does not make sense in my opinion). This logic has never
> been changed so far, so it always behaved like that.
> init.py:
>             foldernames = options.folders.replace(" ", "").split(",")
> 
> Wouldn't it make more sense, to strip just spaces around the commas of a
> list? Such as: init.py:
> 
> -            foldernames = map(strip, options.folders.split(","))
> +            map(lambda s: s.strip(), options.folders.split(","))
> 
> ? I think that change would make sense, but should be documented in the
> Changelog.
> 
> The other option (which should currently work without code change), is to override the
> config option in the form:
> 
> -k "Repository_LocalFOO:folderfilter= lambda f: f in ['INBOX','[Deleted Messages]','[Sent Messages]']"

Perhaps I'm simply implementing it incorrectly, but that caused an
exception and crash when I attempted to implement it (having changed the
LocalFOO to Local, as in my config.  Regardless, thanks for the speedy
answer and for making me feel a bit less crazy.  I'll try the patch
shortly.  

Thanks!

> 
> Does that work?
> 
> Sebastian






More information about the OfflineIMAP-project mailing list