[Kolab-devel] python-kolab
Stéphane Konstantaropoulos
skonstant at sgul.ac.uk
Tue Dec 5 16:35:24 CET 2006
Le mardi 05 déc 2006 14:00, Gunnar Wrobel a écrit :
> Stéphane Konstantaropoulos <skonstant at sgul.ac.uk> writes:
> > However, we need python-ldap in order to retrieve the user home server,
> > not really for anything else, or do we?
>
> Kolab stores a lot of information in LDAP and there might be
> additional features the lib could provide by retrieving information
> from the ldap tree but I'd consider this as additional functionality
> and not the main focus.
>
> But the home-server will be necessary, yes.
>
Yep, we will need ldap in any case.
> > If we go for full blown: Twisted + elementtree + python-ldap, we have 3
> > dependencies. And we can provide more functionality too.
> >
> > What do you think?
>
> I'd be definitely in favour of twisted but don't care too much about
> the xml handler.
>
I just had a (quick) look at twisted for imap and email. It looks a bit more
complex than imaplib / email.Message.
Anybody has a good grasp of it and could answer these few questions:
1. How to connect? (I tried internet.protocol.reactor.connectTCP() but since I
pass a factory, I don't have a handle on the generated IMAP4Client instance,
so I cannot call its methods)
2. Does it handle Cyrus' annotations? The doc of the version I have here
(1.3.0rc1) does not mention it (or perhaps I cannot find it.
3. How to handle message attachments? I guess we can use email.Message on the
raw message body there.
With imaplib, a few lines are enough, it may be less object oriented but it
may be enough for what we do:
serv = imaplib.IMAP4_SSL("imap.example.com")
serv.login("user", "password")
serv.select("INBOX/Calendar")
raw = imaplib.fetch(1, "(RFC822)")
message = email.message_from_string(raw[1][0][1])
message.is_multipart( )
attachment = mess.get_payload(1)
xml_str = attachment.get_payload(decode=True)
And now we process the xml.
In-memory cache is easy enough to implement here, using message uids.
How do you do this with twisted?
I'm a C programmer, so this style makes more sense to me than event-based and
interface-based code.
Cheers,
--
Stéphane Konstantaropoulos <skonstant at sgul.ac.uk>
-- Web Developer - Computing Services
--- St George's University of London
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the devel
mailing list