[PATCH 2/4] Re: Factor out the date guessing/retrieving

Sebastian Spaeth Sebastian at SSpaeth.de
Sun Jan 23 16:58:40 GMT 2011

On Fri, 21 Jan 2011 22:43:02 +0100, Nicolas Sebrecht <nicolas.s-dev at laposte.net> wrote:
> Looks good. While touching this area, we could try to improve the code
> (I don't mean in this particular commit).

Yep, we should try to improve it, bit by bit. It's not too bad, there is
just lots of black magic, that requires insider knowledge by the code
> I'm thinking of
>   UIBase.getglobalui().debug("Message with invalid date %s, using local time instead." % datetuple)

Improved it like that. It's a bit hard in that function to get hold of a
message ID or something, because we would have to parse the whole
email. But we should probably do just that. I agree. Can we keep that
for another patch? I noted it down in my list.

In addition the wrong time could come from the rtime parameter, which in
the maildir<->IMAP case is nothing else then the atime of the maildir
file, I believe (not sure if that is actually a good thing to do or if
that is even the case.). So the wrong time is not necessarily in the
mail file.

> >      def savemessage(self, uid, content, flags, rtime):
> > +        """Save the message on the Server
> > +
> > +        This backend always assigns a new uid, so the uid arg is ignored.
> Why ask for it, then?

It is a function with that API defined in folder/Base.py and all
backends (which derive from Base.py) override that function with
whatever they should do in that case. Some backends take an UID and some
don't. The comment was actually in the code of the function and was just
moved by me to the documentation. :).So it makes sense to provide the
same API to all backends.

-------------- 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/20110123/48728b48/attachment-0001.sig>

More information about the OfflineIMAP-project mailing list