[Dovecot] Problems with BEFORE searches.

Johannes Berg johannes at sipsolutions.net
Fri May 11 18:08:56 EEST 2007


On Fri, 2007-05-11 at 08:54 -0600, Trever Adams wrote:

> > So you'll need to use "11-May-2007". It doesn't support time.
> >   
> Tim, thank you. I am afraid I do not understand if the date is only 
> allowed as such why does python's imaplib convert the date as such?!? 

Interesting. I just noticed another bug too, it pads with spaces:
" 1-May-07 ..."

Try this in my script:

# this line is already there
sentbefore = imaplib.Time2Internaldate(time.time() - float(sys.argv[1]) * 24 * 60 * 60)

# add these lines
sentbefore = sentbefore.split('"')[1].split()[0]
sentbefore = '"%s"' % sentbefore

Or maybe just replace it all with:

sentbefore = time.strftime("%d-%b-%Y", time.localtime(time.time() - float(sys.argv[1]) * 24 * 60 * 60))

johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20070511/d6a62b18/attachment.pgp 


More information about the dovecot mailing list