sslobj

Sebastian Spaeth Sebastian at SSpaeth.de
Sat Dec 4 20:38:29 GMT 2010


I am trying to understand how our imapserver implementation works, and
while the code of offlineimap is very clean and easy to understand in
general, this area twists my brain.

The specific question I have for now, what is self.sslobj? It occurs 4
times, all in imaplibutil.py and apparently serves in IMAPSSL case to
provide a readline implementation.

the imaplib documentation says on readline():
IMAP4.readline()¶
    Reads one line from the remote server. You may override this method.

Why do we need to provide a custom readline function? Does the IMAP4
internal one does not work? We'd save a bit of complexity if we could do
away with that (including the weird ssl.socket wrap thing.

End of specific question, general rant follows :)

----------------------------------------------------------
Overall, this is a complex thing:

An IMAPRepository opens a ConfigedIMAPServer() which
inherits from a class IMAPServer. IMAPServer, opens a connection to an
instance of UsefulIMAP4_SSL (in the SSL case).

class UsefulIMAP4_SSL inherits from UsefulIMAPMixIn (which mostly
provides a select_folder function) and WrappedIMAP4_SSL (which overrides
a read() function to work around a MacOSX bug. No information as to the
bug, is it fixed by now?).

class WrappedIMAP4_SSL in turn inherits from IMAP4_SSL and provides a readline
implementation. But no comment as to why or why the internal readline
isn't fine here... (that's my question above)

For my taste, there is a bit much inheriting and mixin' done here
without clear explanations as to why. But touching the IMAPserver code
is of course scary, as the stuff here might fix bugs that I cannot
test/verify.

Sebastian


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


More information about the OfflineIMAP-project mailing list