[PATCH 1/2] Make a main class OfflineImap that is being called

Sebastian Spaeth Sebastian at sspaeth.de
Mon Dec 6 13:19:36 GMT 2010


On Mon, 6 Dec 2010 13:09:33 +0000, Nicholas Cole <nicholas.cole at gmail.com> wrote:
> > now we do:
> > from offlineimap import OfflineImap
> >
> > offlineimap = OfflineImap()
> > offlineimap.startup('6.2.0')
> 
> Does this mean that OfflineImap can be used within another
> application?  If so, is there any documentation (or example code) on
> how to do this?

Yes, that would essentially mean it.

Currently you would have to:

 from offlineimap import init
 init.startup('6.2.0')
and modify sys.argv to contain the command line options you want (if
 any) :-). Which is essentially what /usb/in/offlineimap does.

(or alternatively you have to use lower-level functions which isn't easy and is part
 of the reason why I propose this patch).

With this (*and* another patch that I want to propse soon), you could
invoke offlineimap from any python app via:

From offlineimap import OfflineImap
offlineimap = OfflineImap(['list','of','command','line','options'])

So easier reuse from other python apps is on my list.

HTH,
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/20101206/5d6b2b0c/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list